mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-03 17:48:56 +01:00 
			
		
		
		
	gioerror: Add conversion from ENXIO to G_IO_ERROR_NOT_REGULAR_FILE
`ENXIO` can be returned from `open(2)` for special files (FIFOs, device files and domain sockets) which are not backed by anything. This fixes the error returned by `g_file_replace()` when trying to replace such a file, so that it now matches the documentation. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
		@@ -107,6 +107,12 @@ g_io_error_from_errno (gint err_no)
 | 
			
		||||
      break;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef ENXIO
 | 
			
		||||
    case ENXIO:
 | 
			
		||||
      return G_IO_ERROR_NOT_REGULAR_FILE;
 | 
			
		||||
      break;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef EROFS
 | 
			
		||||
    case EROFS:
 | 
			
		||||
      return G_IO_ERROR_READ_ONLY;
 | 
			
		||||
 
 | 
			
		||||
@@ -1246,7 +1246,7 @@ test_replace (gconstpointer test_data)
 | 
			
		||||
        FALSE, G_FILE_CREATE_NONE, NULL,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_SOCKET, default_public_mode,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_REGULAR_NONEMPTY, default_public_mode,
 | 
			
		||||
        FALSE, G_IO_ERROR, G_IO_ERROR_FAILED,  /* FIXME Perhaps this should be G_IO_ERROR_NOT_REGULAR_FILE; actually documented as such */
 | 
			
		||||
        FALSE, G_IO_ERROR, G_IO_ERROR_NOT_REGULAR_FILE,
 | 
			
		||||
        2, FILE_TEST_SETUP_TYPE_SOCKET, default_public_mode, NULL,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_REGULAR_NONEMPTY, default_public_mode, original_backup_contents,
 | 
			
		||||
      },
 | 
			
		||||
@@ -1317,7 +1317,7 @@ test_replace (gconstpointer test_data)
 | 
			
		||||
        TRUE, G_FILE_CREATE_NONE, NULL,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_SOCKET, default_public_mode,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_REGULAR_NONEMPTY, default_public_mode,
 | 
			
		||||
        FALSE, G_IO_ERROR, G_IO_ERROR_FAILED,  /* FIXME Perhaps this should be G_IO_ERROR_NOT_REGULAR_FILE; actually documented as such */
 | 
			
		||||
        FALSE, G_IO_ERROR, G_IO_ERROR_NOT_REGULAR_FILE,
 | 
			
		||||
        2, FILE_TEST_SETUP_TYPE_SOCKET, default_public_mode, NULL,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_REGULAR_NONEMPTY, default_public_mode, original_backup_contents,
 | 
			
		||||
      },
 | 
			
		||||
@@ -1451,7 +1451,7 @@ test_replace (gconstpointer test_data)
 | 
			
		||||
        FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_SOCKET, default_public_mode,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_REGULAR_NONEMPTY, default_public_mode,
 | 
			
		||||
        FALSE, G_IO_ERROR, G_IO_ERROR_FAILED,  /* FIXME Perhaps this should be G_IO_ERROR_NOT_REGULAR_FILE; actually documented as such */
 | 
			
		||||
        FALSE, G_IO_ERROR, G_IO_ERROR_NOT_REGULAR_FILE,
 | 
			
		||||
        2, FILE_TEST_SETUP_TYPE_SOCKET, default_public_mode, NULL,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_REGULAR_NONEMPTY, default_public_mode, original_backup_contents,
 | 
			
		||||
      },
 | 
			
		||||
@@ -1526,7 +1526,7 @@ test_replace (gconstpointer test_data)
 | 
			
		||||
        TRUE, G_FILE_CREATE_REPLACE_DESTINATION, NULL,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_SOCKET, default_public_mode,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_REGULAR_NONEMPTY, default_public_mode,
 | 
			
		||||
        FALSE, G_IO_ERROR, G_IO_ERROR_FAILED,  /* FIXME Perhaps this should be G_IO_ERROR_NOT_REGULAR_FILE; actually documented as such */
 | 
			
		||||
        FALSE, G_IO_ERROR, G_IO_ERROR_NOT_REGULAR_FILE,
 | 
			
		||||
        2, FILE_TEST_SETUP_TYPE_SOCKET, default_public_mode, NULL,
 | 
			
		||||
        FILE_TEST_SETUP_TYPE_REGULAR_NONEMPTY, default_public_mode, original_backup_contents,
 | 
			
		||||
      },
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user