git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
appliance: udev-174 moves udevd to /lib/udev/udevd (instead of /sbin/udevd)
[libguestfs.git]
/
daemon
/
devsparts.c
diff --git
a/daemon/devsparts.c
b/daemon/devsparts.c
index
1781def
..
52a6d30
100644
(file)
--- a/
daemon/devsparts.c
+++ b/
daemon/devsparts.c
@@
-89,6
+89,7
@@
foreach_block_device (block_dev_func_t func)
if(0 != errno) {
reply_with_perror ("readdir: /sys/block");
free_stringslen(r, size);
if(0 != errno) {
reply_with_perror ("readdir: /sys/block");
free_stringslen(r, size);
+ closedir (dir);
return NULL;
}
return NULL;
}
@@
-105,8
+106,9
@@
foreach_block_device (block_dev_func_t func)
return NULL;
}
return NULL;
}
- /* Sort the devices */
- sort_strings (r, size);
+ /* Sort the devices. Note that r might be NULL if there are no devices. */
+ if (r != NULL)
+ sort_strings (r, size);
/* NULL terminate the list */
if (add_string (&r, &size, &alloc, NULL) == -1) {
/* NULL terminate the list */
if (add_string (&r, &size, &alloc, NULL) == -1) {
@@
-174,6
+176,7
@@
add_partitions(const char *device,
if(0 != errno) {
reply_with_perror ("readdir: %s", devdir);
free_stringslen(*r, *size);
if(0 != errno) {
reply_with_perror ("readdir: %s", devdir);
free_stringslen(*r, *size);
+ closedir (dir);
return -1;
}
return -1;
}