diff --git a/libostree/ostree-core.c b/libostree/ostree-core.c index d65636c7..9b5b8014 100644 --- a/libostree/ostree-core.c +++ b/libostree/ostree-core.c @@ -259,11 +259,15 @@ ostree_stat_and_checksum_file (int dir_fd, const char *path, device_id = g_strdup_printf ("%u", (guint)stbuf.st_rdev); g_checksum_update (content_sha256, (guint8*)device_id, strlen (device_id)); } + else if (S_ISFIFO(stbuf.st_mode)) + { + g_assert (objtype == OSTREE_OBJECT_TYPE_FILE); + } else { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "Unsupported file '%s' (must be regular, symbolic link, or device)", + "Unsupported file '%s' (must be regular, symbolic link, fifo, or character/block device)", path); goto out; } @@ -477,6 +481,10 @@ ostree_pack_object (GOutputStream *output, device = g_file_info_get_attribute_uint32 (finfo, G_FILE_ATTRIBUTE_UNIX_DEVICE); object_size = 4; } + else if (S_ISFIFO (mode)) + { + object_size = 0; + } else g_assert_not_reached (); @@ -525,6 +533,9 @@ ostree_pack_object (GOutputStream *output, goto out; g_assert (bytes_written == 4); } + else if (S_ISFIFO (mode)) + { + } else g_assert_not_reached (); } @@ -774,6 +785,14 @@ unpack_file (const char *path, goto out; } } + else if (S_ISFIFO (mode)) + { + if (mkfifo (dest_path, mode) < 0) + { + ot_util_set_error_from_errno (error, errno); + goto out; + } + } else { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, diff --git a/libostree/ostree-repo-file.c b/libostree/ostree-repo-file.c index 66268723..6d5162e5 100644 --- a/libostree/ostree-repo-file.c +++ b/libostree/ostree-repo-file.c @@ -827,7 +827,7 @@ query_child_info_file_archive (OstreeRepo *repo, file_type = G_FILE_TYPE_SYMBOLIC_LINK; else if (S_ISREG (mode)) file_type = G_FILE_TYPE_REGULAR; - else if (S_ISBLK (mode) || S_ISCHR(mode)) + else if (S_ISBLK (mode) || S_ISCHR(mode) || S_ISFIFO(mode)) file_type = G_FILE_TYPE_SPECIAL; else { diff --git a/tests/libtest.sh b/tests/libtest.sh index 8ebedf7c..4e3795a3 100644 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -90,6 +90,7 @@ setup_test_repository () { $OSTREE commit -b test2 -s "Test Commit 1" -m "Commit body first" mkdir baz + mkfifo baz/afifo # named pipe echo moo > baz/cow echo alien > baz/saucer mkdir baz/deeper