[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#141500: dpkg: start-stop-daemon, new glibc nice(2) patch



Package: dpkg
Version: 1.9.20
Followup-For: Bug #141500

The changed behavior of nice(2) is described in #136815, and in 
the nice man page:

   NOTES
       Note that the routine is documented in SUSv2 to return the
       new nice value, while the Linux syscall and (g)libc  (ear­
       lier  than glibc 2.2.4) routines return 0 on success.  The
       new nice value can be found  using  getpriority(2).   Note
       that  an implementation in which nice returns the new nice
       value can legitimately return -1.  To reliably  detect  an
       error, set errno to 0 before the call, and check its value
       when nice returns -1.

The following simple patch implements the "reliably detect"
part above.

--- dpkg-1.9.20/utils/start-stop-daemon.c       Sun May 13 15:01:28 2001
+++ dpkg/utils/start-stop-daemon.c      Mon Apr 22 23:38:42 2002
@@ -1151,7 +1151,8 @@
                dup(fd); /* stderr */
        }
        if (nicelevel) {
-               if (nice(nicelevel))
+               errno = 0;
+               if(nice(nicelevel)==-1 && errno !=0) 
                        fatal("Unable to alter nice level by %i: %s", nicelevel,
                                strerror(errno));
        }

thanks,
-neil



-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux poplar 2.4.18enf #5 SMP Mon Mar 18 22:49:18 PST 2002 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages dpkg depends on:
ii  libc6                    2.2.5-4         GNU C Library: Shared libraries an
ii  libncurses5              5.2.20020112a-7 Shared libraries for terminal hand
ii  libstdc++2.10-glibc2.2   1:2.95.4-5      The GNU stdc++ library



-- 
To UNSUBSCRIBE, email to debian-dpkg-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: