summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVáclav Pavlín <vpavlin@redhat.com>2012-09-21 12:40:29 +0200
committerKay Sievers <kay@vrfy.org>2012-09-23 14:24:43 +0200
commit029f4f21fc49389ea2e3168b6f424ee94280680a (patch)
tree1b4014a56445f8844c30b9a67f30c3f7cc4f876d /src
parent8dc8ef598de91326cc7cd21bb705efb8b8960d1c (diff)
libudev: check return value of rename
Diffstat (limited to 'src')
-rw-r--r--src/libudev/libudev-device-private.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libudev/libudev-device-private.c b/src/libudev/libudev-device-private.c
index 00fa3b8890..489bea8480 100644
--- a/src/libudev/libudev-device-private.c
+++ b/src/libudev/libudev-device-private.c
@@ -101,6 +101,7 @@ int udev_device_update_db(struct udev_device *udev_device)
char filename[UTIL_PATH_SIZE];
char filename_tmp[UTIL_PATH_SIZE];
FILE *f;
+ int r;
id = udev_device_get_id_filename(udev_device);
if (id == NULL)
@@ -161,7 +162,9 @@ int udev_device_update_db(struct udev_device *udev_device)
}
fclose(f);
- rename(filename_tmp, filename);
+ r = rename(filename_tmp, filename);
+ if (r < 0)
+ return -1;
udev_dbg(udev, "created %s file '%s' for '%s'\n", has_info ? "db" : "empty",
filename, udev_device_get_devpath(udev_device));
return 0;