diff options
author | Peter Kjellerstedt <pkj@axis.com> | 2013-05-29 11:47:17 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-30 20:56:17 +0100 |
commit | e7796880164d6a37c2699a94e1c5391337c5eaa5 (patch) | |
tree | 2c10fd261ee3357f343a1edf12ea7509c7a254a2 | |
parent | 67dd4e31272918e08b65b5c8d5d6b00e814dbf7f (diff) | |
download | openembedded-core-e7796880164d6a37c2699a94e1c5391337c5eaa5.tar.gz openembedded-core-e7796880164d6a37c2699a94e1c5391337c5eaa5.tar.bz2 openembedded-core-e7796880164d6a37c2699a94e1c5391337c5eaa5.zip |
makedevs: Create blocks of devices with the correct uid/gid
When creating a block of devices (i.e., when count > 0), the wrong
path was used with the call to chown(), effectively trying to change
the owner of some (probably) non-existent file. Thus the created
device nodes were always owned by root.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c index c7ad722f2e..247d6c1c3c 100644 --- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c +++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c @@ -130,7 +130,7 @@ static void add_new_device(char *name, char *path, unsigned long uid, timestamp = sb.st_mtime; } - mknod(name, mode, rdev); + mknod(path, mode, rdev); chown(path, uid, gid); // printf("Device: %s %s UID: %ld GID: %ld MODE: %ld MAJOR: %d MINOR: %d\n", // path, name, uid, gid, mode, (short)(rdev >> 8), (short)(rdev & 0xff)); @@ -198,7 +198,7 @@ static int interpret_table_entry(char *line) error_msg_and_die("Device table entries require absolute paths"); } name = xstrdup(path + 1); - sprintf(path, "%s/%s\0", rootdir, name); + sprintf(path, "%s/%s", rootdir, name); switch (type) { case 'd': @@ -223,6 +223,7 @@ static int interpret_table_entry(char *line) for (i = start; i < count; i++) { sprintf(buf, "%s%d", name, i); + sprintf(path, "%s/%s%d", rootdir, name, i); /* FIXME: MKDEV uses illicit insider knowledge of kernel * major/minor representation... */ rdev = MKDEV(major, minor + (i * increment - start)); |