(mkdir): Use pid_t instead of int; check status
authorJim Meyering <jim@meyering.net>
Tue, 30 Mar 1999 04:47:52 +0000 (04:47 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 30 Mar 1999 04:47:52 +0000 (04:47 +0000)
against zero.  This is to improve portability.

lib/mkdir.c

index 772c686..5ca5af6 100644 (file)
@@ -50,7 +50,8 @@ extern int errno;
 int
 mkdir (const char *dpath, int dmode)
 {
-  int cpid, status;
+  pid_t cpid;
+  int status;
   struct stat statbuf;
 
   if (stat (dpath, &statbuf) == 0)
@@ -84,7 +85,7 @@ mkdir (const char *dpath, int dmode)
       while (wait (&status) != cpid)
        /* Do nothing.  */ ;
 
-      if (status & 0xFFFF)
+      if (status)
        {
          /* /bin/mkdir failed.  */
          errno = EIO;