diff options
Diffstat (limited to 'src/libudev')
-rw-r--r-- | src/libudev/libudev-queue-private.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libudev/libudev-queue-private.c b/src/libudev/libudev-queue-private.c index 80d7ceef2b..51a1d672be 100644 --- a/src/libudev/libudev-queue-private.c +++ b/src/libudev/libudev-queue-private.c @@ -224,8 +224,8 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) if (new_queue_file == NULL) goto error; seqnum = udev_queue_export->seqnum_max; - fwrite(&seqnum, 1, sizeof(unsigned long long int), new_queue_file); - + if (fwrite(&seqnum, 1, sizeof(unsigned long long int), new_queue_file) != sizeof(unsigned long long int)) + goto error; /* copy unfinished events only to the new file */ if (devpaths != NULL) { for (i = devpaths->devpaths_first; i < devpaths->devpaths_size; i++) { @@ -239,9 +239,12 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) err = udev_queue_read_devpath(udev_queue_export->queue_file, devpath, sizeof(devpath)); devpath_len = err; - fwrite(&seqnum, sizeof(unsigned long long int), 1, new_queue_file); - fwrite(&devpath_len, sizeof(unsigned short), 1, new_queue_file); - fwrite(devpath, 1, devpath_len, new_queue_file); + if (fwrite(&seqnum, sizeof(unsigned long long int), 1, new_queue_file) != 1) + goto error; + if (fwrite(&devpath_len, sizeof(unsigned short), 1, new_queue_file) != 1) + goto error; + if (fwrite(devpath, 1, devpath_len, new_queue_file) != devpath_len) + goto error; } seqnum++; } |