[oe-commits] org.oe.dev makedevs: Fix named pipe creation and set file modes correctly
rpurdie commit
openembedded-commits at lists.openembedded.org
Mon Sep 3 00:03:33 UTC 2007
makedevs: Fix named pipe creation and set file modes correctly
Author: rpurdie at openembedded.org
Branch: org.openembedded.dev
Revision: e672e671c803c6418e7dafffe4c149fa8480620a
ViewMTN: http://monotone.openembedded.org/revision.psp?id=e672e671c803c6418e7dafffe4c149fa8480620a
Files:
1
packages/makedevs/makedevs-1.0.0/makedevs.c
packages/makedevs/makedevs_1.0.0.bb
Diffs:
#
# mt diff -r922cbf08d455a151c93083b61f1c51641e7e1055 -re672e671c803c6418e7dafffe4c149fa8480620a
#
#
#
# patch "packages/makedevs/makedevs-1.0.0/makedevs.c"
# from [d8baece6be2666c9a9d240fe16d7577ec42225c5]
# to [f89f9b5686ca9c46e0056a49cab5b9ccd8f63f00]
#
# patch "packages/makedevs/makedevs_1.0.0.bb"
# from [15bdc36f225d6d9098ea881e5a562ec59f1ab3db]
# to [559c6f3caaae0d1bf229e678571ffc998cba407e]
#
============================================================
--- packages/makedevs/makedevs-1.0.0/makedevs.c d8baece6be2666c9a9d240fe16d7577ec42225c5
+++ packages/makedevs/makedevs-1.0.0/makedevs.c f89f9b5686ca9c46e0056a49cab5b9ccd8f63f00
@@ -106,7 +106,8 @@ static void add_new_directory(char *name
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, c
}
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,17 +140,29 @@ static void add_new_file(char *name, cha
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);
+}
+
+
/* device table entries take the form of:
<path> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
/dev/mem c 640 0 0 1 1 0 0 -
@@ -197,7 +211,7 @@ static int interpret_table_entry(char *l
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':
============================================================
--- packages/makedevs/makedevs_1.0.0.bb 15bdc36f225d6d9098ea881e5a562ec59f1ab3db
+++ packages/makedevs/makedevs_1.0.0.bb 559c6f3caaae0d1bf229e678571ffc998cba407e
@@ -1,10 +1,10 @@ S = "${WORKDIR}/makedevs-${PV}"
DESCRIPTION = "A tool to make device nodes"
LICENSE = "GPL"
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}/
More information about the Openembedded-commits
mailing list