summaryrefslogtreecommitdiffstats
path: root/meta/packages/makedevs/makedevs-1.0.0
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-09-02 23:11:14 +0000
committerRichard Purdie <richard@openedhand.com>2007-09-02 23:11:14 +0000
commit3adf5ea1d9498bd043dcbd9fa4413e5567d059cb (patch)
tree86054d2c90897095348adbedf90d8a4355e24d5c /meta/packages/makedevs/makedevs-1.0.0
parentc51edd3fdb40fa7b99a9060828d1b597664800a1 (diff)
downloadpoky-3adf5ea1d9498bd043dcbd9fa4413e5567d059cb.tar.gz
makedevs: Fix named pipe creation and set file modes correctly
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2660 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/makedevs/makedevs-1.0.0')
-rw-r--r--meta/packages/makedevs/makedevs-1.0.0/makedevs.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/meta/packages/makedevs/makedevs-1.0.0/makedevs.c b/meta/packages/makedevs/makedevs-1.0.0/makedevs.c
index 14569c61a2..c7ad722f2e 100644
--- a/meta/packages/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/packages/makedevs/makedevs-1.0.0/makedevs.c
@@ -106,7 +106,8 @@ static char *xstrdup(const char *s)
106static void add_new_directory(char *name, char *path, 106static void add_new_directory(char *name, char *path,
107 unsigned long uid, unsigned long gid, unsigned long mode) 107 unsigned long uid, unsigned long gid, unsigned long mode)
108{ 108{
109 mkdir(path,mode); 109 mkdir(path, mode);
110 chown(path, uid, gid);
110// printf("Directory: %s %s UID: %ld GID %ld MODE: %ld\n", path, name, uid, gid, mode); 111// printf("Directory: %s %s UID: %ld GID %ld MODE: %ld\n", path, name, uid, gid, mode);
111} 112}
112 113
@@ -130,6 +131,7 @@ static void add_new_device(char *name, char *path, unsigned long uid,
130 } 131 }
131 132
132 mknod(name, mode, rdev); 133 mknod(name, mode, rdev);
134 chown(path, uid, gid);
133// printf("Device: %s %s UID: %ld GID: %ld MODE: %ld MAJOR: %d MINOR: %d\n", 135// printf("Device: %s %s UID: %ld GID: %ld MODE: %ld MAJOR: %d MINOR: %d\n",
134// path, name, uid, gid, mode, (short)(rdev >> 8), (short)(rdev & 0xff)); 136// path, name, uid, gid, mode, (short)(rdev >> 8), (short)(rdev & 0xff));
135} 137}
@@ -138,12 +140,24 @@ static void add_new_file(char *name, char *path, unsigned long uid,
138 unsigned long gid, unsigned long mode) 140 unsigned long gid, unsigned long mode)
139{ 141{
140 int fd = open(path,O_CREAT | O_WRONLY, mode); 142 int fd = open(path,O_CREAT | O_WRONLY, mode);
141 if(fd<0) 143 if (fd < 0) {
142 {
143 error_msg_and_die("%s: file can not be created!", path); 144 error_msg_and_die("%s: file can not be created!", path);
144 } else { 145 } else {
145 close(fd); 146 close(fd);
146 } 147 }
148 chmod(path, mode);
149 chown(path, uid, gid);
150// printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n",
151// path, name, gid, uid, mode);
152}
153
154
155static void add_new_fifo(char *name, char *path, unsigned long uid,
156 unsigned long gid, unsigned long mode)
157{
158 if (mknod(path, mode, 0))
159 error_msg_and_die("%s: file can not be created with mknod!", path);
160 chown(path, uid, gid);
147// printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n", 161// printf("File: %s %s UID: %ld GID: %ld MODE: %ld\n",
148// path, name, gid, uid, mode); 162// path, name, gid, uid, mode);
149} 163}
@@ -197,7 +211,7 @@ static int interpret_table_entry(char *line)
197 break; 211 break;
198 case 'p': 212 case 'p':
199 mode |= S_IFIFO; 213 mode |= S_IFIFO;
200 add_new_file(name, path, uid, gid, mode); 214 add_new_fifo(name, path, uid, gid, mode);
201 break; 215 break;
202 case 'c': 216 case 'c':
203 case 'b': 217 case 'b':