diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2024-07-23 10:15:29 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2024-07-23 10:15:29 +0000 |
| commit | d0a542515549a71fa2fb7456326ab99c378d929a (patch) | |
| tree | 9d230d3665cf80992d6521fc474ce2697ac85531 /notify.c | |
| parent | notify: clean up logging messages (diff) | |
notify: add_icon(): check return value of write()
Diffstat (limited to 'notify.c')
| -rw-r--r-- | notify.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -303,11 +303,14 @@ add_icon(struct notification_icon *icon, const char *id, const char *symbolic_na return; } - write(fd, data, data_sz); - close(fd); + if (write(fd, data, data_sz) != (ssize_t)data_sz) { + LOG_ERRNO("failed to write icon data to temporary file"); + } else { + LOG_DBG("wrote icon data to %s", name); + icon->tmp_file_on_disk = xstrdup(name); + } - LOG_DBG("wrote icon data to %s", name); - icon->tmp_file_on_disk = xstrdup(name); + close(fd); } LOG_DBG("added icon to cache: ID=%s: sym=%s, file=%s", |
