summaryrefslogtreecommitdiff
path: root/meta/packages
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
parentc51edd3fdb40fa7b99a9060828d1b597664800a1 (diff)
downloadopenembedded-core-3adf5ea1d9498bd043dcbd9fa4413e5567d059cb.tar.gz
openembedded-core-3adf5ea1d9498bd043dcbd9fa4413e5567d059cb.tar.bz2
openembedded-core-3adf5ea1d9498bd043dcbd9fa4413e5567d059cb.tar.xz
openembedded-core-3adf5ea1d9498bd043dcbd9fa4413e5567d059cb.zip
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')
-rw-r--r--meta/packages/makedevs/makedevs-1.0.0/makedevs.c22
-rw-r--r--meta/packages/makedevs/makedevs_1.0.0.bb2
2 files changed, 19 insertions, 5 deletions
diff --git a/meta/packages/makedevs/makedevs-1.0.0/makedevs.c b/meta/packages/makedevs/makedevs-1.0.0/makedevs.c
index 14569c61a..c7ad722f2 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)
static void add_new_directory(char *name, char *path,
unsigned long uid, unsigned long gid, unsigned long mode)
{
- mkdir(path,mode);
+ mkdir(path, mode);
+ chown(path, uid, gid);
// printf("Directory: %s %s UID: %ld GID %ld MODE: %ld\n", path, name, uid, gid, mode);
}
@@ -130,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));
}
@@ -138,12 +140,24 @@ 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)
- {
+ 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);
}
@@ -197,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':
diff --git a/meta/packages/makedevs/makedevs_1.0.0.bb b/meta/packages/makedevs/makedevs_1.0.0.bb
index 422d91108..c78b73b6e 100644
--- a/meta/packages/makedevs/makedevs_1.0.0.bb
+++ b/meta/packages/makedevs/makedevs_1.0.0.bb
@@ -4,7 +4,7 @@ SECTION = "base"
PRIORITY = "required"
SRC_URI = "file://makedevs.c"
S = "${WORKDIR}/makedevs-${PV}"
-PR = "r3"
+PR = "r5"
do_configure() {
install -m 0644 ${WORKDIR}/makedevs.c ${S}/