diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-17 20:29:00 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-17 20:29:00 +0000 |
commit | a7189f01a4a19a9c8852e84b322fc3d8cbda92eb (patch) | |
tree | 436e3ab7b6f055553199153e99f6b7589fb488ec /procps | |
parent | 04c6386c45cd795617dd754066ac3bd6a62757cb (diff) | |
download | busybox-a7189f01a4a19a9c8852e84b322fc3d8cbda92eb.tar.gz |
add -Wundef, fix uncovered bugs
Diffstat (limited to 'procps')
-rw-r--r-- | procps/renice.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/procps/renice.c b/procps/renice.c index bcaa94cf1..65674a4ee 100644 --- a/procps/renice.c +++ b/procps/renice.c @@ -20,23 +20,11 @@ */ #include "busybox.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <limits.h> -#include <errno.h> -#include <unistd.h> #include <sys/resource.h> -#if (PRIO_PROCESS < CHAR_MIN) || (PRIO_PROCESS > CHAR_MAX) -#error Assumption violated : PRIO_PROCESS value -#endif -#if (PRIO_PGRP < CHAR_MIN) || (PRIO_PGRP > CHAR_MAX) -#error Assumption violated : PRIO_PGRP value -#endif -#if (PRIO_USER < CHAR_MIN) || (PRIO_USER > CHAR_MAX) -#error Assumption violated : PRIO_USER value -#endif +void BUG_bad_PRIO_PROCESS(void); +void BUG_bad_PRIO_PGRP(void); +void BUG_bad_PRIO_USER(void); int renice_main(int argc, char **argv) { @@ -49,6 +37,14 @@ int renice_main(int argc, char **argv) unsigned who; char *arg; + /* Yes, they are not #defines in glibc 2.4! #if won't work */ + if (PRIO_PROCESS < CHAR_MIN || PRIO_PROCESS > CHAR_MAX) + BUG_bad_PRIO_PROCESS(); + if (PRIO_PGRP < CHAR_MIN || PRIO_PGRP > CHAR_MAX) + BUG_bad_PRIO_PGRP(); + if (PRIO_USER < CHAR_MIN || PRIO_USER > CHAR_MAX) + BUG_bad_PRIO_USER(); + arg = *++argv; /* Check if we are using a relative adjustment. */ |