r2224 - alfs-POC/src

jhuntwork at linuxfromscratch.org jhuntwork at linuxfromscratch.org
Sat Nov 26 09:56:32 PST 2005


Author: jhuntwork
Date: 2005-11-26 10:56:32 -0700 (Sat, 26 Nov 2005)
New Revision: 2224

Modified:
   alfs-POC/src/alfsd.c
Log:
Fixed error checking

Modified: alfs-POC/src/alfsd.c
===================================================================
--- alfs-POC/src/alfsd.c	2005-11-26 17:37:44 UTC (rev 2223)
+++ alfs-POC/src/alfsd.c	2005-11-26 17:56:32 UTC (rev 2224)
@@ -55,18 +55,16 @@
 		/* execute the string as a system command */
 		syscmd = system(buff);
 
-		switch (syscmd)
-		{
-		  case -1:
-			perror("system");
-		  case 0:
+		if (syscmd == 0)
 		  	snprintf(buff, 29, "CLIENT: Command successful!\n");
-		  case 127:
-		  case 32512:
-		    {
-		    	snprintf(buff, 29, "CLIENT: Command failed!\n");
-		    }
-		}
+
+		if (syscmd == 32512)
+		    	snprintf(buff, 25, "CLIENT: Command failed!\n");
+
+		if (syscmd == -1)
+			perror("system");
+		
+		
 		printf("Exit status of command was: %d\n", syscmd);
 		write(connfd, buff, strlen(buff));
 		close(connfd);




More information about the alfs-log mailing list