diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-05-04 10:04:08 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-05-07 16:19:53 -0400 |
commit | 0155928c3cc1792b50ab031d08b6152e2ae260f6 (patch) | |
tree | a3ded9d45b7c4f839262609ce910a9937d984edd /src/shared | |
parent | 94ad3616c8b01d07eb8bf4b111e81c89e6cd57f9 (diff) |
shared/install: simplify error handling conditionals in a few places
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/install.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index cc36da1853..f0b63506a9 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1247,18 +1247,15 @@ static int unit_file_search( return -ENOMEM; r = unit_file_load_or_readlink(c, info, path, paths->root_dir, flags); - if (r < 0) { - if (r != -ENOENT) - return r; - } else { + if (r >= 0) { info->path = path; path = NULL; return r; - } + } else if (r != -ENOENT) + return r; } if (unit_name_is_valid(info->name, UNIT_NAME_INSTANCE)) { - /* Unit file doesn't exist, however instance * enablement was requested. We will check if it is * possible to load template unit file. */ @@ -1277,14 +1274,12 @@ static int unit_file_search( return -ENOMEM; r = unit_file_load_or_readlink(c, info, path, paths->root_dir, flags); - if (r < 0) { - if (r != -ENOENT) - return r; - } else { + if (r >= 0) { info->path = path; path = NULL; return r; - } + } else if (r != -ENOENT) + return r; } } @@ -1355,13 +1350,10 @@ static int install_info_traverse( } r = install_info_follow(c, i, paths->root_dir, flags); - if (r < 0) { + if (r == -EXDEV) { _cleanup_free_ char *buffer = NULL; const char *bn; - if (r != -EXDEV) - return r; - /* Target has a different name, create a new * install info object for that, and continue * with that. */ @@ -1388,12 +1380,12 @@ static int install_info_traverse( if (r < 0) return r; + /* Try again, with the new target we found. */ r = unit_file_search(c, i, paths, flags); - if (r < 0) - return r; } - /* Try again, with the new target we found. */ + if (r < 0) + return r; } if (ret) |