summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-04-03 14:05:01 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-04-05 00:55:19 -0400
commitecb08ec6a5c52f2d940f3b8147e2a480affd46e1 (patch)
treef909eb71377461b3002c82612ca23165f17ae29a /src/udev
parentee0e4cca5ac37a094dfe1074907dae70c7b7701c (diff)
Fix a few return codes in error paths
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/net/link-config.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 5bb6b02c1b..0c563b2db5 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -139,7 +139,7 @@ void link_config_ctx_free(link_config_ctx *ctx) {
}
static int load_link(link_config_ctx *ctx, const char *filename) {
- link_config *link;
+ _cleanup_free_ link_config *link = NULL;
_cleanup_fclose_ FILE *file;
int r;
@@ -151,14 +151,12 @@ static int load_link(link_config_ctx *ctx, const char *filename) {
if (errno == ENOENT)
return 0;
else
- return errno;
+ return -errno;
}
link = new0(link_config, 1);
- if (!link) {
- r = log_oom();
- goto failure;
- }
+ if (!link)
+ return log_oom();
link->mac_policy = _MACPOLICY_INVALID;
link->wol = _WOL_INVALID;
@@ -168,19 +166,16 @@ static int load_link(link_config_ctx *ctx, const char *filename) {
(void*) link_config_gperf_lookup, false, false, link);
if (r < 0) {
log_warning("Could not parse config file %s: %s", filename, strerror(-r));
- goto failure;
+ return r;
} else
log_debug("Parsed configuration file %s", filename);
link->filename = strdup(filename);
LIST_PREPEND(links, ctx->links, link);
+ link = NULL;
return 0;
-
-failure:
- free(link);
- return r;
}
static bool enable_name_policy(void) {