svn commit: [25870] trunk/busybox/shell
vapier at busybox.net
vapier at busybox.net
Sun Mar 29 00:50:30 UTC 2009
Author: vapier
Date: 2009-03-29 00:50:30 +0000 (Sun, 29 Mar 2009)
New Revision: 25870
Log:
use bb_strtou() in umask/wait and check errno to see if there was a problem rather than using endp
Modified:
trunk/busybox/shell/hush.c
Changeset:
Modified: trunk/busybox/shell/hush.c
===================================================================
--- trunk/busybox/shell/hush.c 2009-03-29 00:45:26 UTC (rev 25869)
+++ trunk/busybox/shell/hush.c 2009-03-29 00:50:30 UTC (rev 25870)
@@ -4892,12 +4892,10 @@
{
mode_t new_umask;
const char *arg = argv[1];
- char *end;
if (arg) {
- new_umask = strtoul(arg, &end, 8);
- if (*end != '\0' || end == arg) {
+ new_umask = bb_strtou(arg, NULL, 8);
+ if (errno)
return EXIT_FAILURE;
- }
} else {
new_umask = umask(0);
printf("%.3o\n", (unsigned) new_umask);
@@ -4924,9 +4922,8 @@
wait(&status);
while (argv[1]) {
- char *endp;
- pid_t pid = bb_strtou(argv[1], &endp, 10);
- if (*endp) {
+ pid_t pid = bb_strtou(argv[1], NULL, 10);
+ if (errno) {
bb_perror_msg("wait %s", argv[1]);
return EXIT_FAILURE;
} else if (waitpid(pid, &status, 0) == pid) {
More information about the busybox-cvs
mailing list