mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-31 05:14:11 +02:00
GMappedFile: return an error when trying to map a device
Previously, we were returning an empty buffer for all filenames where fstat() gives a size of 0. But this is only appropriate for regular files. Also improve the documentation around this issue. Based on a patch by Ryan Lortie. Conflicts: glib/tests/mappedfile.c https://bugzilla.gnome.org/show_bug.cgi?id=659212
This commit is contained in:
@@ -36,6 +36,18 @@ test_empty (void)
|
||||
g_mapped_file_free (file);
|
||||
}
|
||||
|
||||
static void
|
||||
test_device (void)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GMappedFile *file;
|
||||
|
||||
file = g_mapped_file_new ("/dev/null", FALSE, &error);
|
||||
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL);
|
||||
g_assert (file == NULL);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
static void
|
||||
test_nonexisting (void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user