diff options
author | tjr <tjr@FreeBSD.org> | 2005-10-01 05:36:39 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2005-10-01 05:36:39 +0000 |
commit | 058cbad8094e4a18727e0f0366e1f5b2cbc25468 (patch) | |
tree | ec559e2bc8ca33412fa4fcc075aacb838ed2d707 /contrib | |
parent | d2ed906427de5fad605fdfb6abee1ab90f082333 (diff) | |
download | FreeBSD-src-058cbad8094e4a18727e0f0366e1f5b2cbc25468.zip FreeBSD-src-058cbad8094e4a18727e0f0366e1f5b2cbc25468.tar.gz |
Merge from old copyin.c rev 1.5, copypass.c rev 1.2: Create fifos using
mkfifo() instead of attempting to create them using mknod().
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/cpio/src/copyin.c | 20 | ||||
-rw-r--r-- | contrib/cpio/src/copypass.c | 20 |
2 files changed, 32 insertions, 8 deletions
diff --git a/contrib/cpio/src/copyin.c b/contrib/cpio/src/copyin.c index a1063a3..c8a21e5 100644 --- a/contrib/cpio/src/copyin.c +++ b/contrib/cpio/src/copyin.c @@ -1,3 +1,5 @@ +/* $FreeBSD$ */ + /* copyin.c - extract or list a cpio archive Copyright (C) 1990,1991,1992,2001,2002,2003,2004 Free Software Foundation, Inc. @@ -742,13 +744,23 @@ copyin_device(struct new_cpio_header* file_hdr) return; } - res = mknod (file_hdr->c_name, file_hdr->c_mode, - makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min)); +#ifdef CP_IFIFO + if ((file_hdr->c_mode & CP_IFMT) == CP_IFIFO) + res = mkfifo (file_hdr->c_name, file_hdr->c_mode); + else +#endif + res = mknod (file_hdr->c_name, file_hdr->c_mode, + makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min)); if (res < 0 && create_dir_flag) { create_all_directories (file_hdr->c_name); - res = mknod (file_hdr->c_name, file_hdr->c_mode, - makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min)); +#ifdef CP_IFIFO + if ((file_hdr->c_mode & CP_IFMT) == CP_IFIFO) + res = mkfifo (file_hdr->c_name, file_hdr->c_mode); + else +#endif + res = mknod (file_hdr->c_name, file_hdr->c_mode, + makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min)); } if (res < 0) { diff --git a/contrib/cpio/src/copypass.c b/contrib/cpio/src/copypass.c index db6f327..0827f9c 100644 --- a/contrib/cpio/src/copypass.c +++ b/contrib/cpio/src/copypass.c @@ -1,3 +1,5 @@ +/* $FreeBSD$ */ + /* copypass.c - cpio copy pass sub-function. Copyright (C) 1990, 1991, 1992, 2001, 2003, 2004 Free Software Foundation, Inc. @@ -311,13 +313,23 @@ process_copy_pass () if (link_res < 0) { - res = mknod (output_name.ds_string, in_file_stat.st_mode, - in_file_stat.st_rdev); +#ifdef S_ISFIFO + if (S_ISFIFO (in_file_stat.st_mode)) + res = mkfifo (output_name.ds_string, in_file_stat.st_mode); + else +#endif + res = mknod (output_name.ds_string, in_file_stat.st_mode, + in_file_stat.st_rdev); if (res < 0 && create_dir_flag) { create_all_directories (output_name.ds_string); - res = mknod (output_name.ds_string, in_file_stat.st_mode, - in_file_stat.st_rdev); +#ifdef S_ISFIFO + if (S_ISFIFO (in_file_stat.st_mode)) + res = mkfifo (output_name.ds_string, in_file_stat.st_mode); + else +#endif + res = mknod (output_name.ds_string, in_file_stat.st_mode, + in_file_stat.st_rdev); } if (res < 0) { |