Rework the last fix to avoid an unheeded return error

Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Doug Ledford 2011-03-26 14:16:54 -04:00
parent 27c1d165f5
commit 7e15eefc27

View File

@ -95,21 +95,25 @@
} }
} }
--- mdadm-3.1.5/sysfs.c.param 2011-03-26 14:03:54.206714522 -0400 --- mdadm-3.1.5/sysfs.c.param 2011-03-26 14:03:54.206714522 -0400
+++ mdadm-3.1.5/sysfs.c 2011-03-26 14:04:37.277821858 -0400 +++ mdadm-3.1.5/sysfs.c 2011-03-26 14:16:12.101936859 -0400
@@ -422,7 +422,6 @@ int sysfs_set_num(struct mdinfo *sra, st @@ -422,7 +422,7 @@ int sysfs_set_num(struct mdinfo *sra, st
int sysfs_uevent(struct mdinfo *sra, char *event) int sysfs_uevent(struct mdinfo *sra, char *event)
{ {
char fname[50]; char fname[50];
- int n; - int n;
+ unsigned int n;
int fd; int fd;
sprintf(fname, "/sys/block/%s/uevent", sprintf(fname, "/sys/block/%s/uevent",
@@ -430,7 +429,7 @@ int sysfs_uevent(struct mdinfo *sra, cha @@ -432,6 +432,11 @@ int sysfs_uevent(struct mdinfo *sra, cha
fd = open(fname, O_WRONLY);
if (fd < 0)
return -1; return -1;
- n = write(fd, event, strlen(event)); n = write(fd, event, strlen(event));
+ write(fd, event, strlen(event));
close(fd); close(fd);
+ if (n != strlen(event)) {
+ dprintf(Name ": failed to write '%s' to '%s' (%s)\n",
+ event, fname, strerror(errno));
+ return -1;
+ }
return 0; return 0;
} }