svn commit: trunk/busybox/util-linux
landley at busybox.net
landley at busybox.net
Sun Jan 22 23:14:18 UTC 2006
Author: landley
Date: 2006-01-22 15:14:16 -0800 (Sun, 22 Jan 2006)
New Revision: 13495
Log:
There was a missing ! on strcmp (despite the fact it worked in my testing,
I have no idea _how_), and a simpler fix for the extra \n problem. I tested
this and it worked for me, for what that's worth...
Modified:
trunk/busybox/util-linux/mdev.c
Changeset:
Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c 2006-01-22 22:55:11 UTC (rev 13494)
+++ trunk/busybox/util-linux/mdev.c 2006-01-22 23:14:16 UTC (rev 13495)
@@ -43,23 +43,13 @@
fd = open(temp, O_RDONLY);
len = read(fd, temp, PATH_MAX-1);
if (len<1) goto end;
- temp[--len] = 0; // remove trailing \n
close(fd);
/* Determine device name, type, major and minor */
device_name = strrchr(path, '/') + 1;
type = strncmp(path+5, "block/" ,6) ? S_IFCHR : S_IFBLK;
- major = minor = 0;
- for (s = temp; *s; s++) {
- if (*s == ':') {
- major = minor;
- minor = 0;
- } else {
- minor *= 10;
- minor += (*s) - '0';
- }
- }
+ if(sscanf(temp, "%d:%d", &major, &minor) != 2) goto end;
/* If we have a config file, look up permissions for this device */
@@ -202,7 +192,7 @@
/* If there's a dev entry, mknod it */
- if (strcmp(entry->d_name, "dev")) make_device(path);
+ if (!strcmp(entry->d_name, "dev")) make_device(path);
}
closedir(dir);
More information about the busybox-cvs
mailing list