projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
"formated" -> "formatted" throughout the code base.
[oweals/busybox.git]
/
miscutils
/
makedevs.c
diff --git
a/miscutils/makedevs.c
b/miscutils/makedevs.c
index 7bfe54fc19fb8f3f66019881932f47ce746919d3..776bcaa8d9a7a82e4604a000893b288a222d4abf 100644
(file)
--- a/
miscutils/makedevs.c
+++ b/
miscutils/makedevs.c
@@
-1,5
+1,13
@@
/* vi: set sw=4 ts=4: */
/* vi: set sw=4 ts=4: */
+/*
+ * public domain -- Dave 'Kill a Cop' Cinege <dcinege@psychosis.com>
+ *
+ * makedevs
+ * Make ranges of device files quickly.
+ * known bugs: can't deal with alpha ranges
+ */
+#include "busybox.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@
-9,16
+17,8
@@
#include <unistd.h>
#include <sys/types.h>
#include <sys/sysmacros.h> /* major() and minor() */
#include <unistd.h>
#include <sys/types.h>
#include <sys/sysmacros.h> /* major() and minor() */
-#include "busybox.h"
#ifdef CONFIG_FEATURE_MAKEDEVS_LEAF
#ifdef CONFIG_FEATURE_MAKEDEVS_LEAF
-/*
- * public domain -- Dave 'Kill a Cop' Cinege <dcinege@psychosis.com>
- *
- * makedevs
- * Make ranges of device files quickly.
- * known bugs: can't deal with alpha ranges
- */
int makedevs_main(int argc, char **argv)
{
mode_t mode;
int makedevs_main(int argc, char **argv)
{
mode_t mode;
@@
-77,7
+77,7
@@
int makedevs_main(int argc, char **argv)
/* Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */
/* Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */
-
extern
int makedevs_main(int argc, char **argv)
+int makedevs_main(int argc, char **argv)
{
FILE *table = stdin;
char *rootdir = NULL;
{
FILE *table = stdin;
char *rootdir = NULL;
@@
-86,7
+86,7
@@
extern int makedevs_main(int argc, char **argv)
int ret = EXIT_SUCCESS;
unsigned long flags;
int ret = EXIT_SUCCESS;
unsigned long flags;
- flags = bb_getopt_ulflags(argc, argv, "d:", &line);
+ flags = bb_getopt_ulflags(argc, argv, "d:", &line);
if (line)
table = bb_xfopen(line, "r");
if (line)
table = bb_xfopen(line, "r");
@@
-94,9
+94,7
@@
extern int makedevs_main(int argc, char **argv)
bb_error_msg_and_die("root directory not specified");
}
bb_error_msg_and_die("root directory not specified");
}
- if (chdir(rootdir) != 0) {
- bb_perror_msg_and_die("could not chdir to %s", rootdir);
- }
+ bb_xchdir(rootdir);
umask(0);
umask(0);
@@
-138,9
+136,9
@@
extern int makedevs_main(int argc, char **argv)
if (name[0] == '#') {
continue;
}
if (name[0] == '#') {
continue;
}
-
- gid =
group
? get_ug_id(group, bb_xgetgrnam) : getgid();
- uid =
user
? get_ug_id(user, bb_xgetpwnam) : getuid();
+
+ gid =
(*group)
? get_ug_id(group, bb_xgetgrnam) : getgid();
+ uid =
(*user)
? get_ug_id(user, bb_xgetpwnam) : getuid();
full_name = concat_path_file(rootdir, name);
if (type == 'd') {
full_name = concat_path_file(rootdir, name);
if (type == 'd') {
@@
-234,9
+232,9
@@
loop:
}
fclose(table);
}
fclose(table);
- return
0
;
+ return
ret
;
}
#else
}
#else
-# error mak
d
edevs configuration error, either leaf or table must be selected
+# error makedevs configuration error, either leaf or table must be selected
#endif
#endif