summaryrefslogtreecommitdiff
path: root/src/libudev
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-12-01 18:15:43 +0100
committerLennart Poettering <lennart@poettering.net>2016-12-07 18:38:40 +0100
commit9e70a49dc779ca8a082a96eb8eb6b4aec18dd966 (patch)
tree6540e1c87f6f9917248d8a7977799ad381db8404 /src/libudev
parent3e7b9f76f56db77fa1e8a09b543176c7ddd136de (diff)
libudev: set errno if udev_new() fails
All other constructors in libudev do that, let's also do this for udev_new().
Diffstat (limited to 'src/libudev')
-rw-r--r--src/libudev/libudev.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
index 57ce749e07..d8e13288b0 100644
--- a/src/libudev/libudev.c
+++ b/src/libudev/libudev.c
@@ -97,8 +97,10 @@ _public_ struct udev *udev_new(void) {
_cleanup_fclose_ FILE *f = NULL;
udev = new0(struct udev, 1);
- if (udev == NULL)
+ if (!udev) {
+ errno = -ENOMEM;
return NULL;
+ }
udev->refcount = 1;
f = fopen("/etc/udev/udev.conf", "re");