From 84834b817c79cd8d5bca169e7ce1d3d1a7c24af8 Mon Sep 17 00:00:00 2001 From: bde Date: Sun, 13 Jul 1997 14:07:48 +0000 Subject: Create fifos using mkfifo() instead of attempting to create them using mknod(). --- contrib/cpio/copyin.c | 19 +++++++++++++++---- contrib/cpio/copypass.c | 18 ++++++++++++++---- 2 files changed, 29 insertions(+), 8 deletions(-) (limited to 'contrib/cpio') diff --git a/contrib/cpio/copyin.c b/contrib/cpio/copyin.c index bfb9536..6f2db39 100644 --- a/contrib/cpio/copyin.c +++ b/contrib/cpio/copyin.c @@ -928,13 +928,24 @@ process_copy_in () break; } - 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/copypass.c b/contrib/cpio/copypass.c index dde43d5..9c27ac5 100644 --- a/contrib/cpio/copypass.c +++ b/contrib/cpio/copypass.c @@ -295,13 +295,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) { -- cgit v1.1