zed: untangle _zed_conf_parse_path()
Dunno, maybe it's just me, but the previous style was /really/ confusing Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #11860
This commit is contained in:
parent
32cc3f0837
commit
bb8db9d927
|
@ -206,16 +206,19 @@ _zed_conf_parse_path(char **resultp, const char *path)
|
||||||
|
|
||||||
if (path[0] == '/') {
|
if (path[0] == '/') {
|
||||||
*resultp = strdup(path);
|
*resultp = strdup(path);
|
||||||
} else if (!getcwd(buf, sizeof (buf))) {
|
} else {
|
||||||
|
if (!getcwd(buf, sizeof (buf)))
|
||||||
zed_log_die("Failed to get current working dir: %s",
|
zed_log_die("Failed to get current working dir: %s",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
} else if (strlcat(buf, "/", sizeof (buf)) >= sizeof (buf)) {
|
|
||||||
zed_log_die("Failed to copy path: %s", strerror(ENAMETOOLONG));
|
if (strlcat(buf, "/", sizeof (buf)) >= sizeof (buf) ||
|
||||||
} else if (strlcat(buf, path, sizeof (buf)) >= sizeof (buf)) {
|
strlcat(buf, path, sizeof (buf)) >= sizeof (buf))
|
||||||
zed_log_die("Failed to copy path: %s", strerror(ENAMETOOLONG));
|
zed_log_die("Failed to copy path: %s",
|
||||||
} else {
|
strerror(ENAMETOOLONG));
|
||||||
|
|
||||||
*resultp = strdup(buf);
|
*resultp = strdup(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*resultp)
|
if (!*resultp)
|
||||||
zed_log_die("Failed to copy path: %s", strerror(ENOMEM));
|
zed_log_die("Failed to copy path: %s", strerror(ENOMEM));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue