diff options
author | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2007-10-07 00:34:07 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2007-10-07 00:34:07 +0000 |
commit | 2f8521c6d1173dd650d9ae2bba8c18e690fa3b1f (patch) | |
tree | 06bc2b997b60797bc42f696f3427f92890089d2b /packages/makedevs/makedevs-1.0.0/makedevs.c | |
parent | 0d0bf315513039bd8560ac91865c7174e789d675 (diff) | |
parent | 6e90aae26efa66553063b74b9afa9563b70fb982 (diff) |
merge of '603b2d0c7e4ad80e5779bd3bbdb822331cc0ea2b'
and '6ab53da82d157971966f5a17d0c29d54df22cac9'
Diffstat (limited to 'packages/makedevs/makedevs-1.0.0/makedevs.c')
-rw-r--r-- | packages/makedevs/makedevs-1.0.0/makedevs.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/packages/makedevs/makedevs-1.0.0/makedevs.c b/packages/makedevs/makedevs-1.0.0/makedevs.c index a9bf8e782a..c7ad722f2e 100644 --- a/packages/makedevs/makedevs-1.0.0/makedevs.c +++ b/packages/makedevs/makedevs-1.0.0/makedevs.c @@ -106,6 +106,8 @@ static char *xstrdup(const char *s) static void add_new_directory(char *name, char *path, unsigned long uid, unsigned long gid, unsigned long mode) { + mkdir(path, mode); + chown(path, uid, gid); // printf("Directory: %s %s UID: %ld GID %ld MODE: %ld\n", path, name, uid, gid, mode); } @@ -129,6 +131,7 @@ static void add_new_device(char *name, char *path, unsigned long uid, } mknod(name, 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)); } @@ -136,6 +139,25 @@ static void add_new_device(char *name, char *path, unsigned long uid, static void add_new_file(char *name, char *path, unsigned long uid, unsigned long gid, unsigned long mode) { + int fd = open(path,O_CREAT | O_WRONLY, mode); + if (fd < 0) { + error_msg_and_die("%s: file can not be created!", path); + } else { + close(fd); + } + chmod(path, mode); + chown(path, uid, gid); +// printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n", +// path, name, gid, uid, mode); +} + + +static void add_new_fifo(char *name, char *path, unsigned long uid, + unsigned long gid, unsigned long mode) +{ + if (mknod(path, mode, 0)) + error_msg_and_die("%s: file can not be created with mknod!", path); + chown(path, uid, gid); // printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n", // path, name, gid, uid, mode); } @@ -189,7 +211,7 @@ static int interpret_table_entry(char *line) break; case 'p': mode |= S_IFIFO; - add_new_file(name, path, uid, gid, mode); + add_new_fifo(name, path, uid, gid, mode); break; case 'c': case 'b': |