aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-06 02:04:32 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-06 02:04:32 +0200
commit3532e60ca890979030949793933442afaec272fb (patch)
tree65c7d31cff66b15c502e4ca3d7d1d56a895b08ca
parent637982f5bbe7a5be4e5409ab0404df2583e7c299 (diff)
downloadbusybox-w32-3532e60ca890979030949793933442afaec272fb.tar.gz
busybox-w32-3532e60ca890979030949793933442afaec272fb.tar.bz2
busybox-w32-3532e60ca890979030949793933442afaec272fb.zip
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>
-rw-r--r--miscutils/makedevs.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 9e7ca340f..fec1045e4 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -208,17 +208,17 @@ int makedevs_main(int argc UNUSED_PARAM, char **argv)
208 unsigned count = 0; 208 unsigned count = 0;
209 unsigned increment = 0; 209 unsigned increment = 0;
210 unsigned start = 0; 210 unsigned start = 0;
211 char name[41];
212 char user[41]; 211 char user[41];
213 char group[41]; 212 char group[41];
214 char *full_name = name; 213 char *full_name;
214 int name_len;
215 uid_t uid; 215 uid_t uid;
216 gid_t gid; 216 gid_t gid;
217 217
218 linenum = parser->lineno; 218 linenum = parser->lineno;
219 219
220 if ((2 > sscanf(line, "%40s %c %o %40s %40s %u %u %u %u %u", 220 if ((1 > sscanf(line, "%*s%n %c %o %40s %40s %u %u %u %u %u",
221 name, &type, &mode, user, group, 221 &name_len, &type, &mode, user, group,
222 &major, &minor, &start, &increment, &count)) 222 &major, &minor, &start, &increment, &count))
223 || ((unsigned)(major | minor | start | count | increment) > 255) 223 || ((unsigned)(major | minor | start | count | increment) > 255)
224 ) { 224 ) {
@@ -229,9 +229,11 @@ int makedevs_main(int argc UNUSED_PARAM, char **argv)
229 229
230 gid = (*group) ? get_ug_id(group, xgroup2gid) : getgid(); 230 gid = (*group) ? get_ug_id(group, xgroup2gid) : getgid();
231 uid = (*user) ? get_ug_id(user, xuname2uid) : getuid(); 231 uid = (*user) ? get_ug_id(user, xuname2uid) : getuid();
232 line[name_len] = '\0';
233 full_name = line;
232 /* We are already in the right root dir, 234 /* We are already in the right root dir,
233 * so make absolute paths relative */ 235 * so make absolute paths relative */
234 if ('/' == *full_name) 236 if ('/' == full_name[0])
235 full_name++; 237 full_name++;
236 238
237 if (type == 'd') { 239 if (type == 'd') {