wok-current rev 17060

syslinux/c32box: x86_64 auto select (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Aug 21 14:58:48 2014 +0200 (2014-08-21)
parents e96cc1fa3f68
children 96d0569c8793
files syslinux/stuff/extra/md5sum.c
line diff
     1.1 --- a/syslinux/stuff/extra/md5sum.c	Thu Aug 21 11:59:26 2014 +0200
     1.2 +++ b/syslinux/stuff/extra/md5sum.c	Thu Aug 21 14:58:48 2014 +0200
     1.3 @@ -794,19 +794,23 @@
     1.4  
     1.5  static char *extfilename(char *filename, char *ext, int feature)
     1.6  {
     1.7 -#define NEWFILENAMESZ 80
     1.8 +#define NEWFILENAMESZ 256
     1.9  	static char newfilename[NEWFILENAMESZ+1];
    1.10  	char *found = filename;
    1.11 -	FILE *fp;
    1.12 +	char *new = newfilename;
    1.13 +	int fd;
    1.14  
    1.15  	if (strlen(filename) + strlen(ext) <= NEWFILENAMESZ) {
    1.16  		strcpy(newfilename, filename);
    1.17  		if (cpu_has_feature(feature)) {
    1.18  			strcat(newfilename, ext);
    1.19 -			fp = fopen(newfilename, "r");
    1.20 -			if (fp)
    1.21 -				found = newfilename;
    1.22 -			fclose(fp);
    1.23 +			fd = open(new, O_RDONLY);
    1.24 +			if (fd < 0)
    1.25 +				fd = open(new = unrockridge(new), O_RDONLY);
    1.26 +			if (fd >= 0) {
    1.27 +				found = new;
    1.28 +				close(fd);
    1.29 +			}
    1.30  		}
    1.31  	}
    1.32  	return found;