Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 14359 - start-stop-daemon --nicelevel won't work
Summary: start-stop-daemon --nicelevel won't work
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
: 16467 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-01-22 04:29 UTC by YAMAKURA Makoto
Modified: 2021-08-19 06:21 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description YAMAKURA Makoto 2003-01-22 04:29:53 UTC
Executing start-stop-daemon with --nicelevel option won't work.

example: (code from http://www.gentoo.org/doc/en/rsync.xml)
start-stop-daemon --start --quiet --pidfile /var/run/rsyncd.pid --nicelevel 15 --exec /usr/bin/rsync -- ${RSYNCOPTS}

result:
start-stop-daemon: Unable to alter nice level by 15: Success      [ !! ]


start-stop-daemon.c (sys-apps/baselayout) doesn't use nice(2) correctly. 
According to libc.info, its return value is the new nicelevel on success,
and -1 on failure.

man 2 nice says that nice return 0 on success, that's not true.
Comment 1 Martin Holzer (RETIRED) gentoo-dev 2003-01-22 05:02:23 UTC
which version of baselayout ?
Comment 2 YAMAKURA Makoto 2003-01-22 05:14:25 UTC
Sorry for missing information:

$ qpkg -v -f /sbin/start-stop-daemon
sys-apps/baselayout-1.8.5.8 *
(rc-scripts-1.4.2.8.tar.bz2)

thanks in advance,
Comment 3 YAMAKURA Makoto 2003-01-24 02:22:30 UTC
Hi,

Here is a fix for this bug. This works for me.

http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo-src/rc-scripts/sbin/start-stop-daemon.c

--- start-stop-daemon.c	2001-12-09 07:19:04.000000000 +0900
+++ start-stop-daemon.c	2003-01-24 17:01:49.000000000 +0900
@@ -945,7 +945,7 @@
 		dup(fd); /* stderr */
 	}
 	if (nicelevel) {
-		if (nice(nicelevel))
+		if (nice(nicelevel)==-1 && errno)
 			fatal("Unable to alter nice level by %i: %s", nicelevel,
 				strerror(errno));
 	}
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2003-01-26 01:38:54 UTC
Looks good.  Fixed on CVS, thanks.
Comment 5 SpanKY gentoo-dev 2003-02-27 06:58:48 UTC
*** Bug 16467 has been marked as a duplicate of this bug. ***