libudev: set errno if udev_new() fails

All other constructors in libudev do that, let's also do this for udev_new().
This commit is contained in:
Lennart Poettering 2016-12-01 18:15:43 +01:00
parent 3e7b9f76f5
commit 9e70a49dc7

View file

@ -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");