char num[32];
udev_device->ifindex = ifindex;
- snprintf(num, sizeof(num), "%u", ifindex);
+ snprintf(num, sizeof(num), "%d", ifindex);
udev_device_add_property(udev_device, "IFINDEX", num);
return 0;
}
}
f = fopen(dbfile, "re");
- if (f == NULL) {
- log_debug_errno(errno, "no db file to read %s: %m", dbfile);
- return -errno;
- }
+ if (f == NULL)
+ return log_debug_errno(errno, "no db file to read %s: %m", dbfile);
/* devices with a database entry are initialized */
udev_device->is_initialized = true;
return NULL;
} else {
/* everything else just needs to be a directory */
- if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode))
+ if (stat(path, &statbuf) != 0)
return NULL;
+
+ if (!S_ISDIR(statbuf.st_mode)) {
+ errno = EISDIR;
+ return NULL;
+ }
}
udev_device = udev_device_new(udev);