Revision: 2725
          http://ipcop.svn.sourceforge.net/ipcop/?rev=2725&view=rev
Author:   gespinasse
Date:     2009-04-19 12:51:00 +0000 (Sun, 19 Apr 2009)

Log Message:
-----------
Warn on log when there is a \n inside a command executed by mysystem
That make mysystem always return 0 even in case of command failure.

Modified Paths:
--------------
    ipcop/trunk/src/installer/helper.c

Modified: ipcop/trunk/src/installer/helper.c
===================================================================
--- ipcop/trunk/src/installer/helper.c  2009-04-18 19:45:54 UTC (rev 2724)
+++ ipcop/trunk/src/installer/helper.c  2009-04-19 12:51:00 UTC (rev 2725)
@@ -111,7 +111,11 @@
 int mysystem(char *command)
 {
     char mycommand[STRING_SIZE_LARGE + 64];     //we have a large buffer for 
the initrd setup!
+    int cr = 0;
 
+    if (strchr(mycommand, '\n') == 0)
+        cr = 1;
+
 #if 0
     snprintf(mycommand, STRING_SIZE, "%s >>%s 2>>%s", command, flog, flog);
 #else
@@ -119,6 +123,8 @@
 #endif
     if (flog != NULL) {
         fprintf(flog, "Running command: %s\n", command);
+        if (cr)
+            fprintf(flog, "WARNING mysystem return value is always 0 when a CR 
is on command\n");
     }
     return system(mycommand);
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Ipcop-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to