summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Woestenberg <leon.woestenberg@gmail.com>2007-08-20 17:58:47 +0000
committerLeon Woestenberg <leon.woestenberg@gmail.com>2007-08-20 17:58:47 +0000
commitd89e27e308b8755528b07b77026a0ce4fb619391 (patch)
treeb6cdff7b7edbdd3c002ea595db9ccb90c79fb97d
parent71cd75a213bb84bce4e549ee8e706f59d25df0a6 (diff)
makedevs: Add support for creating directories.
-rw-r--r--packages/makedevs/makedevs-1.0.0/makedevs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/makedevs/makedevs-1.0.0/makedevs.c b/packages/makedevs/makedevs-1.0.0/makedevs.c
index a9bf8e782a..14569c61a2 100644
--- a/packages/makedevs/makedevs-1.0.0/makedevs.c
+++ b/packages/makedevs/makedevs-1.0.0/makedevs.c
@@ -106,6 +106,7 @@ 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);
// printf("Directory: %s %s UID: %ld GID %ld MODE: %ld\n", path, name, uid, gid, mode);
}
@@ -136,6 +137,13 @@ 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);
+ }
// printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n",
// path, name, gid, uid, mode);
}