wok-next diff syslinux/stuff/iso2exe/boot.c @ rev 16022

syslinux/iso2exe: add zimage support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Mar 06 19:57:41 2014 +0000 (2014-03-06)
parents 3bb29e042c1c
children d814ca840c3c
line diff
     1.1 --- a/syslinux/stuff/iso2exe/boot.c	Tue Mar 04 21:00:29 2014 +0000
     1.2 +++ b/syslinux/stuff/iso2exe/boot.c	Thu Mar 06 19:57:41 2014 +0000
     1.3 @@ -67,6 +67,13 @@
     1.4  	return 0;
     1.5  }
     1.6  
     1.7 +static int chkstatus(int status, char *name)
     1.8 +{
     1.9 +	if (status == -1)
    1.10 +		printf("%s not found.\n",name);
    1.11 +	return status;
    1.12 +}
    1.13 +
    1.14  static char *iso;
    1.15  static int fakeopen(char *file)
    1.16  {
    1.17 @@ -78,14 +85,15 @@
    1.18  	if (*file == '\\') {
    1.19  		static fd = -1;
    1.20  		if (fd >= 0) close(fd);
    1.21 -		return open(file, O_RDONLY);
    1.22 +		fd = chkstatus(open(file, O_RDONLY), file);
    1.23 +		return fd;
    1.24  	}
    1.25  	if (iso) {
    1.26 -		isoreset(iso);
    1.27 -		return isoopen(file);
    1.28 +		chkstatus(isoreset(iso), iso);
    1.29 +		return chkstatus(isoopen(file), file);
    1.30  	}
    1.31  	close(isofd);
    1.32 -	isofd = open(file, O_RDONLY);
    1.33 +	isofd = chkstatus(open(file, O_RDONLY), file);
    1.34  	if (isofd != -1) {
    1.35  		isofileofs = 0;
    1.36  		isofilesize = LONG_MAX;
    1.37 @@ -100,7 +108,7 @@
    1.38  	
    1.39  	argv[0] = progname();
    1.40  	bootiso(argv);	// iso ? parsing is /init.exe stuff !
    1.41 -	if (argc == 2)
    1.42 +	if (argc >= 2)
    1.43  		bootiso(argv + 1);
    1.44  
    1.45  	chdirname(*argv);
    1.46 @@ -127,7 +135,7 @@
    1.47  	}
    1.48  	if (cmdfile) {
    1.49  		int fd;
    1.50 -		fd = open(cmdfile, O_RDONLY);;
    1.51 +		fd = chkstatus(open(cmdfile, O_RDONLY), chkstatus);
    1.52  		if (fd != -1) {
    1.53  			read(fd, args, sizeof(args));
    1.54  			close(fd);