implemented numeric sort (sort -g)
[oweals/busybox.git] / utility.c
index 42ee00c505c244d1e9296336aac2ddf055975227..d01be9c98c87b74f1cd81a2a937f27100e694146 100644 (file)
--- a/utility.c
+++ b/utility.c
@@ -217,10 +217,12 @@ copyFile( const char *srcName, const char *destName,
     if (setModes == TRUE) {
        //fprintf(stderr, "Setting permissions for %s\n", destName);
        chmod(destName, srcStatBuf.st_mode);
-       if (followLinks == TRUE)
-           chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid);
-       else
+#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
+       if (followLinks == FALSE)
            lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid);
+       else
+#endif
+           chown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid);
 
        times.actime = srcStatBuf.st_atime;
        times.modtime = srcStatBuf.st_mtime;
@@ -376,7 +378,7 @@ int fullRead(int fd, char *buf, int len)
 #endif
 
 
-#if defined (BB_CHOWN) || defined (BB_CP) || defined (BB_FIND) || defined (BB_LS)
+#if defined (BB_CHOWN) || defined (BB_CP) || defined (BB_FIND) || defined (BB_LS) || defined (BB_INSMOD)
 /*
  * Walk down all the directories under the specified 
  * location, and do something (something specified
@@ -1068,7 +1070,12 @@ extern long getNum (const char *cp)
 }
 #endif
 
-#if 1
+
+#if defined BB_INIT || defined BB_HALT || defined BB_REBOOT 
+
+#if ! defined BB_FEATURE_USE_PROCFS
+#error Sorry, I depend on the /proc filesystem right now.
+#endif
 /* findInitPid()
  *  
  *  This finds the pid of init (which is not always 1).
@@ -1095,7 +1102,7 @@ findInitPid()
        fgets(buffer, 256, status);
        fclose(status);
 
-       if ( (strcmp(&buffer[6], "init\n") == 0)) {
+       if ( (strstr(buffer, "init\n") != NULL )) {
            return init_pid;
        }
     }