nps: poci/nws_poci.c - don't exec /bin/mv when we have rename(2)

baggins baggins at pld-linux.org
Tue Sep 13 18:50:12 CEST 2005


Author: baggins                      Date: Tue Sep 13 16:50:12 2005 GMT
Module: nps                           Tag: HEAD
---- Log message:
- don't exec /bin/mv when we have rename(2)

---- Files affected:
nps/poci:
   nws_poci.c (1.12 -> 1.13) 

---- Diffs:

================================================================
Index: nps/poci/nws_poci.c
diff -u nps/poci/nws_poci.c:1.12 nps/poci/nws_poci.c:1.13
--- nps/poci/nws_poci.c:1.12	Tue Sep 13 18:45:33 2005
+++ nps/poci/nws_poci.c	Tue Sep 13 18:50:07 2005
@@ -54,6 +54,7 @@
 #include <sys/stat.h>
 #include <resolv.h>         //contains path for /etc/resolv.conf
 #include <signal.h>
+#include <errno.h>
 
 #if KERNEL_HAS_MCE
 #include <pci/pci.h>
@@ -1613,8 +1614,9 @@
         fclose(inFile);
         close(outFile);
 
-        snprintf(line,BUFSIZE,"/bin/mv %s %s",outFileName, _PATH_RESCONF);
-        rc = system(line);
+	rc = rename(outFileName, _PATH_RESCONF);
+	if (rc < 0)
+		rc = errno;
 
         snprintf(line,BUFSIZE,"<cmdRetVal>%d</cmdRetVal>",rc);
         strncat(outBuf, line, AVAIL(outBuf));
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/nps/poci/nws_poci.c?r1=1.12&r2=1.13&f=u




More information about the pld-cvs-commit mailing list