chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Be more careful when checking for empty files
[elogind.git]
/
src
/
udev
/
net
/
link-config.c
diff --git
a/src/udev/net/link-config.c
b/src/udev/net/link-config.c
index 73243fa107b1fe87ebcdc2e8254e9d8cbd62e6fb..512885f9c8604ced0757f4dd476133e7b3ab9dc8 100644
(file)
--- a/
src/udev/net/link-config.c
+++ b/
src/udev/net/link-config.c
@@
-153,11
+153,6
@@
static int load_link(link_config_ctx *ctx, const char *filename) {
assert(ctx);
assert(filename);
assert(ctx);
assert(filename);
- if (null_or_empty_path(filename)) {
- log_debug("skipping empty file: %s", filename);
- return 0;
- }
-
file = fopen(filename, "re");
if (!file) {
if (errno == ENOENT)
file = fopen(filename, "re");
if (!file) {
if (errno == ENOENT)
@@
-166,6
+161,11
@@
static int load_link(link_config_ctx *ctx, const char *filename) {
return -errno;
}
return -errno;
}
+ if (null_or_empty_fd(fileno(file))) {
+ log_debug("Skipping empty file: %s", filename);
+ return 0;
+ }
+
link = new0(link_config, 1);
if (!link)
return log_oom();
link = new0(link_config, 1);
if (!link)
return log_oom();