mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
osdep: add qemu_unlink()
Add a helper function to match qemu_open() which may return files under the /dev/fdset prefix. Those shouldn't be removed, since it's only a qemu namespace. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
c5f2bce5ee
commit
ee13240e60
2 changed files with 16 additions and 0 deletions
15
util/osdep.c
15
util/osdep.c
|
@ -370,6 +370,21 @@ int qemu_close(int fd)
|
|||
return close(fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete a file from the filesystem, unless the filename is /dev/fdset/...
|
||||
*
|
||||
* Returns: On success, zero is returned. On error, -1 is returned,
|
||||
* and errno is set appropriately.
|
||||
*/
|
||||
int qemu_unlink(const char *name)
|
||||
{
|
||||
if (g_str_has_prefix(name, "/dev/fdset/")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return unlink(name);
|
||||
}
|
||||
|
||||
/*
|
||||
* A variant of write(2) which handles partial write.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue