core: Support named pipes
This is mainly useful for sysvinit's "/dev/initctl".
This commit is contained in:
parent
1d23e4b8e8
commit
a103218fd1
|
|
@ -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);
|
device_id = g_strdup_printf ("%u", (guint)stbuf.st_rdev);
|
||||||
g_checksum_update (content_sha256, (guint8*)device_id, strlen (device_id));
|
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
|
else
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IO_ERROR,
|
g_set_error (error, G_IO_ERROR,
|
||||||
G_IO_ERROR_FAILED,
|
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);
|
path);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -477,6 +481,10 @@ ostree_pack_object (GOutputStream *output,
|
||||||
device = g_file_info_get_attribute_uint32 (finfo, G_FILE_ATTRIBUTE_UNIX_DEVICE);
|
device = g_file_info_get_attribute_uint32 (finfo, G_FILE_ATTRIBUTE_UNIX_DEVICE);
|
||||||
object_size = 4;
|
object_size = 4;
|
||||||
}
|
}
|
||||||
|
else if (S_ISFIFO (mode))
|
||||||
|
{
|
||||||
|
object_size = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
||||||
|
|
@ -525,6 +533,9 @@ ostree_pack_object (GOutputStream *output,
|
||||||
goto out;
|
goto out;
|
||||||
g_assert (bytes_written == 4);
|
g_assert (bytes_written == 4);
|
||||||
}
|
}
|
||||||
|
else if (S_ISFIFO (mode))
|
||||||
|
{
|
||||||
|
}
|
||||||
else
|
else
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
|
|
@ -774,6 +785,14 @@ unpack_file (const char *path,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (S_ISFIFO (mode))
|
||||||
|
{
|
||||||
|
if (mkfifo (dest_path, mode) < 0)
|
||||||
|
{
|
||||||
|
ot_util_set_error_from_errno (error, errno);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
|
|
|
||||||
|
|
@ -827,7 +827,7 @@ query_child_info_file_archive (OstreeRepo *repo,
|
||||||
file_type = G_FILE_TYPE_SYMBOLIC_LINK;
|
file_type = G_FILE_TYPE_SYMBOLIC_LINK;
|
||||||
else if (S_ISREG (mode))
|
else if (S_ISREG (mode))
|
||||||
file_type = G_FILE_TYPE_REGULAR;
|
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;
|
file_type = G_FILE_TYPE_SPECIAL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ setup_test_repository () {
|
||||||
$OSTREE commit -b test2 -s "Test Commit 1" -m "Commit body first"
|
$OSTREE commit -b test2 -s "Test Commit 1" -m "Commit body first"
|
||||||
|
|
||||||
mkdir baz
|
mkdir baz
|
||||||
|
mkfifo baz/afifo # named pipe
|
||||||
echo moo > baz/cow
|
echo moo > baz/cow
|
||||||
echo alien > baz/saucer
|
echo alien > baz/saucer
|
||||||
mkdir baz/deeper
|
mkdir baz/deeper
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue