aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mdev.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-01-22 23:14:16 +0000
committerRob Landley <rob@landley.net>2006-01-22 23:14:16 +0000
commite927743bb022996e9f5c75d3ef20696fc5049dbf (patch)
treef71daa487c79705a1f47f766cd2bdafba6e159c0 /util-linux/mdev.c
parent86f5c9906beac527f3d7966f24811b571a589e08 (diff)
downloadbusybox-w32-e927743bb022996e9f5c75d3ef20696fc5049dbf.tar.gz
busybox-w32-e927743bb022996e9f5c75d3ef20696fc5049dbf.tar.bz2
busybox-w32-e927743bb022996e9f5c75d3ef20696fc5049dbf.zip
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...
Diffstat (limited to 'util-linux/mdev.c')
-rw-r--r--util-linux/mdev.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 135843581..a18e44835 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -43,23 +43,13 @@ static void make_device(char *path)
43 fd = open(temp, O_RDONLY); 43 fd = open(temp, O_RDONLY);
44 len = read(fd, temp, PATH_MAX-1); 44 len = read(fd, temp, PATH_MAX-1);
45 if (len<1) goto end; 45 if (len<1) goto end;
46 temp[--len] = 0; // remove trailing \n
47 close(fd); 46 close(fd);
48 47
49 /* Determine device name, type, major and minor */ 48 /* Determine device name, type, major and minor */
50 49
51 device_name = strrchr(path, '/') + 1; 50 device_name = strrchr(path, '/') + 1;
52 type = strncmp(path+5, "block/" ,6) ? S_IFCHR : S_IFBLK; 51 type = strncmp(path+5, "block/" ,6) ? S_IFCHR : S_IFBLK;
53 major = minor = 0; 52 if(sscanf(temp, "%d:%d", &major, &minor) != 2) goto end;
54 for (s = temp; *s; s++) {
55 if (*s == ':') {
56 major = minor;
57 minor = 0;
58 } else {
59 minor *= 10;
60 minor += (*s) - '0';
61 }
62 }
63 53
64 /* If we have a config file, look up permissions for this device */ 54 /* If we have a config file, look up permissions for this device */
65 55
@@ -202,7 +192,7 @@ static void find_dev(char *path)
202 192
203 /* If there's a dev entry, mknod it */ 193 /* If there's a dev entry, mknod it */
204 194
205 if (strcmp(entry->d_name, "dev")) make_device(path); 195 if (!strcmp(entry->d_name, "dev")) make_device(path);
206 } 196 }
207 197
208 closedir(dir); 198 closedir(dir);