summaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorDenys Vlasenko2017-07-06 02:04:32 +0200
committerDenys Vlasenko2017-07-06 02:04:32 +0200
commit3532e60ca890979030949793933442afaec272fb (patch)
tree65c7d31cff66b15c502e4ca3d7d1d56a895b08ca /miscutils
parent637982f5bbe7a5be4e5409ab0404df2583e7c299 (diff)
downloadbusybox-3532e60ca890979030949793933442afaec272fb.zip
busybox-3532e60ca890979030949793933442afaec272fb.tar.gz
makedevs: allow much longer filenames
function old new delta makedevs_main 1056 1071 +15 Patch by Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/makedevs.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 9e7ca34..fec1045 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -208,17 +208,17 @@ int makedevs_main(int argc UNUSED_PARAM, char **argv)
unsigned count = 0;
unsigned increment = 0;
unsigned start = 0;
- char name[41];
char user[41];
char group[41];
- char *full_name = name;
+ char *full_name;
+ int name_len;
uid_t uid;
gid_t gid;
linenum = parser->lineno;
- if ((2 > sscanf(line, "%40s %c %o %40s %40s %u %u %u %u %u",
- name, &type, &mode, user, group,
+ if ((1 > sscanf(line, "%*s%n %c %o %40s %40s %u %u %u %u %u",
+ &name_len, &type, &mode, user, group,
&major, &minor, &start, &increment, &count))
|| ((unsigned)(major | minor | start | count | increment) > 255)
) {
@@ -229,9 +229,11 @@ int makedevs_main(int argc UNUSED_PARAM, char **argv)
gid = (*group) ? get_ug_id(group, xgroup2gid) : getgid();
uid = (*user) ? get_ug_id(user, xuname2uid) : getuid();
+ line[name_len] = '\0';
+ full_name = line;
/* We are already in the right root dir,
* so make absolute paths relative */
- if ('/' == *full_name)
+ if ('/' == full_name[0])
full_name++;
if (type == 'd') {