notify: add_icon(): check return value of write()

This commit is contained in:
Daniel Eklöf 2024-07-23 12:15:29 +02:00
parent 9814cf5779
commit d0a5425155
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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",