Newer glibc's nice(2) return the new nice value, instead of 0 or -1.
Adrian M. Enache [Wed, 23 Apr 2003 22:48:20 +0000 (01:48 +0300)]
Check errno to see if the call to nice(2) succeeded.
Subject: Re: [PATCH++] all about the recent standard conforming glibc's nic
Message-ID: <20030423194820.GA874@ratsnest.hole>

p4raw-id: //depot/perl@19356

ext/POSIX/POSIX.xs

index 519f741..f1e1013 100644 (file)
@@ -1386,9 +1386,17 @@ lseek(fd, offset, whence)
     OUTPUT:
        RETVAL
 
-SysRet
+SV *
 nice(incr)
        int             incr
+    PPCODE:
+       errno = 0;
+       if ((incr = nice(incr)) != -1 || errno == 0) {
+           if (incr == 0)
+               XPUSHs(sv_2mortal(newSVpvn("0 but true", 10)));
+           else
+               XPUSHs(sv_2mortal(newSViv(incr)));
+       }
 
 void
 pipe()