aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/makedevs
diff options
context:
space:
mode:
authorSaul Wold <sgw@linux.intel.com>2013-10-01 16:57:52 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-01 22:56:03 +0100
commitb618f74d6e87ac36ca7dad25c830fa8526614320 (patch)
tree69c5b40296b63abb9465ae3f4db4e8a6f0f0f83d /meta/recipes-devtools/makedevs
parentd80472c4e3c8110bdc441a8d6f5b27d9c25c6432 (diff)
downloadopenembedded-core-contrib-b618f74d6e87ac36ca7dad25c830fa8526614320.tar.gz
makedevs: Do not return error if the fifo exisits
This ensures that makedevs will not cause image creation failures when it encounters a pipe (fifo) that exists from a previous image. This handles mode changes and it will correctly fail for dangling symlinks. [YOCTO #5288] (From OE-Core rev: 3a4b0e7973bef43f16058137e64600e2f890b117) Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/makedevs')
-rw-r--r--meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index 5d2c45b310..53700c687f 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -274,8 +274,20 @@ static void add_new_file(char *name, char *path, unsigned long uid,
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);
+ int status;
+ struct stat sb;
+
+ memset(&sb, 0, sizeof(struct stat));
+ status = stat(path, &sb);
+
+
+ /* Update the mode if we exist and are a fifo already */
+ if (status >= 0 && S_ISFIFO(sb.st_mode)) {
+ chmod(path, mode);
+ } else {
+ 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: %04lo\n",
// path, name, gid, uid, mode);