Skip to content

Commit

Permalink
confd: unchecked return value from remove()
Browse files Browse the repository at this point in the history
Not much we can do, other than log and report.

Found by Coverity Scan

Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
troglobit committed Sep 2, 2024
1 parent 377cea6 commit 5d7d8aa
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/confd/src/ietf-syslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ static void action(sr_session_ctx_t *session, const char *name, const char *xpat
if (!selector(session, &act)) {
/* No selectors, must've been a delete operation after all. */
fclose(act.fp);
remove(act.path);
if (remove(act.path))
ERRNO("failed removing %s", act.path);
return;
}

Expand Down Expand Up @@ -229,10 +230,12 @@ static int file_change(sr_session_ctx_t *session, uint32_t sub_id, const char *m
const char *name;

name = getnm(node, path, sizeof(path));
if (op == LYDX_OP_DELETE)
remove(filename(name, false, path, sizeof(path)));
else
if (op == LYDX_OP_DELETE) {
if (remove(filename(name, false, path, sizeof(path))))
ERRNO("failed removing %s", path);
} else {
action(session, name, path, NULL);
}
}

srx_free_changes(tree);
Expand Down Expand Up @@ -263,7 +266,8 @@ static int remote_change(sr_session_ctx_t *session, uint32_t sub_id, const char

name = getnm(node, path, sizeof(path));
if (op == LYDX_OP_DELETE) {
remove(filename(name, true, path, sizeof(path)));
if (remove(filename(name, true, path, sizeof(path))))
ERRNO("failed removing %s", path);
} else {
struct addr addr;

Expand Down Expand Up @@ -324,7 +328,8 @@ static int server_change(sr_session_ctx_t *session, uint32_t sub_id, const char
return SR_ERR_OK;

if (!srx_enabled(session, "%s/enabled", xpath)) {
remove(SYSLOG_SERVER);
if (remove(SYSLOG_SERVER))
ERRNO("failed disabling syslog server");
goto done;
}

Expand Down

0 comments on commit 5d7d8aa

Please sign in to comment.