Skip to content

Commit 3b342af

Browse files
committed
general: fix compiler warning about unused results
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
1 parent 5a5ea76 commit 3b342af

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

src/dbus.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,10 @@ static bool cdbus_process_windows_root_introspect(session_t *ps, DBusMessage *ms
14351435
continue;
14361436
}
14371437
char *tmp = NULL;
1438-
asprintf(&tmp, "<node name='%#010x'/>\n", w->id);
1438+
if (asprintf(&tmp, "<node name='%#010x'/>\n", w->id) < 0) {
1439+
log_fatal("Failed to allocate memory.");
1440+
abort();
1441+
}
14391442
mstrextend(&ret, tmp);
14401443
free(tmp);
14411444
}

src/log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static void file_logger_write(struct log_target *tgt, const char *str, size_t le
256256
static void file_logger_writev(struct log_target *tgt, const struct iovec *vec, int vcnt) {
257257
auto f = (struct file_logger *)tgt;
258258
fflush(f->f);
259-
writev(fileno(f->f), vec, vcnt);
259+
ssize_t _ attr_unused = writev(fileno(f->f), vec, vcnt);
260260
}
261261

262262
static void file_logger_destroy(struct log_target *tgt) {

src/picom.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2560,7 +2560,11 @@ int main(int argc, char **argv) {
25602560
// Notify the parent that we are done. This might cause the parent
25612561
// to quit, so only do this after setsid()
25622562
int tmp = 1;
2563-
write(pfds[1], &tmp, sizeof tmp);
2563+
if (write(pfds[1], &tmp, sizeof tmp) != sizeof tmp) {
2564+
log_fatal("Failed to notify parent process");
2565+
ret_code = 1;
2566+
break;
2567+
}
25642568
close(pfds[1]);
25652569
// We only do this once
25662570
need_fork = false;

src/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void report_allocation_failure(const char *func, const char *file, unsigned int
2727
{.iov_base = (void *)msg2, .iov_len = sizeof(msg2) - 1},
2828
};
2929

30-
writev(STDERR_FILENO, v, ARR_SIZE(v));
30+
ssize_t _ attr_unused = writev(STDERR_FILENO, v, ARR_SIZE(v));
3131
abort();
3232

3333
unreachable;

0 commit comments

Comments
 (0)