Skip to content

Commit

Permalink
general: fix compiler warning about unused results
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Dec 14, 2022
1 parent 5a5ea76 commit 3b342af
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,10 @@ static bool cdbus_process_windows_root_introspect(session_t *ps, DBusMessage *ms
continue;
}
char *tmp = NULL;
asprintf(&tmp, "<node name='%#010x'/>\n", w->id);
if (asprintf(&tmp, "<node name='%#010x'/>\n", w->id) < 0) {
log_fatal("Failed to allocate memory.");
abort();
}
mstrextend(&ret, tmp);
free(tmp);
}
Expand Down
2 changes: 1 addition & 1 deletion src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static void file_logger_write(struct log_target *tgt, const char *str, size_t le
static void file_logger_writev(struct log_target *tgt, const struct iovec *vec, int vcnt) {
auto f = (struct file_logger *)tgt;
fflush(f->f);
writev(fileno(f->f), vec, vcnt);
ssize_t _ attr_unused = writev(fileno(f->f), vec, vcnt);
}

static void file_logger_destroy(struct log_target *tgt) {
Expand Down
6 changes: 5 additions & 1 deletion src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -2560,7 +2560,11 @@ int main(int argc, char **argv) {
// Notify the parent that we are done. This might cause the parent
// to quit, so only do this after setsid()
int tmp = 1;
write(pfds[1], &tmp, sizeof tmp);
if (write(pfds[1], &tmp, sizeof tmp) != sizeof tmp) {
log_fatal("Failed to notify parent process");
ret_code = 1;
break;
}
close(pfds[1]);
// We only do this once
need_fork = false;
Expand Down
2 changes: 1 addition & 1 deletion src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void report_allocation_failure(const char *func, const char *file, unsigned int
{.iov_base = (void *)msg2, .iov_len = sizeof(msg2) - 1},
};

writev(STDERR_FILENO, v, ARR_SIZE(v));
ssize_t _ attr_unused = writev(STDERR_FILENO, v, ARR_SIZE(v));
abort();

unreachable;
Expand Down

0 comments on commit 3b342af

Please sign in to comment.