r650 - x86/trunk/initramfs

jhuntwork at linuxfromscratch.org jhuntwork at linuxfromscratch.org
Sat Sep 17 05:37:59 PDT 2005


Author: jhuntwork
Date: 2005-09-17 06:37:58 -0600 (Sat, 17 Sep 2005)
New Revision: 650

Modified:
   x86/trunk/initramfs/init.c
Log:
Some more tweaks to init.c

Modified: x86/trunk/initramfs/init.c
===================================================================
--- x86/trunk/initramfs/init.c	2005-09-17 12:25:42 UTC (rev 649)
+++ x86/trunk/initramfs/init.c	2005-09-17 12:37:58 UTC (rev 650)
@@ -192,20 +192,17 @@
 			continue; /* On to the next device!! */
 		} 
 
-		close(fd); /* We don't need this fd any more */
-
 		if (status != CDS_DISC_OK)
 		{
 			/* We'll probably get here if there's no CD in the drive */
 			printf("%s: Drive not ready\n", curdevice);
+			close(fd);
 			continue; /* On to the next device!! */
 		}
 
 		/* If we're here, the cd drive seems to have a disc in it, and is okay! 
 		   Now we'll try to match the Volume ID */
 
-		fd = open(curdevice, O_RDONLY);	
-
 		lseek(fd, ISO_PD_BLOCK*ISO_BLOCK_SIZE, SEEK_SET);
 
 		/* Read the ISO Block info and fill a struct with it */
@@ -223,6 +220,7 @@
 		i = strncmp(VOLUME_ID, pd.volume_id, strlen(VOLUME_ID));
 		if (i!=0) {
 			printf("This is not the correct CD. Moving on...\n");
+			close(fd);
 			continue;
 		}
 
@@ -231,6 +229,7 @@
 		if (status<0)
 		{
 			printf("%s: mount failed: %s\n", curdevice, strerror(errno));
+			close(fd);
 			continue; /* On to the next device!! */
 		} 
 




More information about the livecd mailing list