mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
udev/net: use null_or_empty_path()
This commit is contained in:
parent
e406e8a29a
commit
e8e2788dab
@ -110,7 +110,6 @@ int link_config_ctx_new(link_config_ctx **ret) {
|
|||||||
|
|
||||||
int link_load_one(link_config_ctx *ctx, const char *filename) {
|
int link_load_one(link_config_ctx *ctx, const char *filename) {
|
||||||
_cleanup_(link_config_freep) link_config *link = NULL;
|
_cleanup_(link_config_freep) link_config *link = NULL;
|
||||||
_cleanup_fclose_ FILE *file = NULL;
|
|
||||||
_cleanup_free_ char *name = NULL;
|
_cleanup_free_ char *name = NULL;
|
||||||
const char *dropin_dirname;
|
const char *dropin_dirname;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -119,11 +118,12 @@ int link_load_one(link_config_ctx *ctx, const char *filename) {
|
|||||||
assert(ctx);
|
assert(ctx);
|
||||||
assert(filename);
|
assert(filename);
|
||||||
|
|
||||||
file = fopen(filename, "re");
|
r = null_or_empty_path(filename);
|
||||||
if (!file)
|
if (r == -ENOENT)
|
||||||
return errno == ENOENT ? 0 : -errno;
|
return 0;
|
||||||
|
if (r < 0)
|
||||||
if (null_or_empty_fd(fileno(file))) {
|
return r;
|
||||||
|
if (r > 0) {
|
||||||
log_debug("Skipping empty file: %s", filename);
|
log_debug("Skipping empty file: %s", filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user