]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Check error return on a couple of syscalls.
authorMichael Labuschke <michael@labuschke.de>
Mon, 23 Oct 2006 04:56:35 +0000 (14:56 +1000)
committerNeil Brown <neilb@suse.de>
Mon, 23 Oct 2006 04:56:35 +0000 (14:56 +1000)
From: "Michael Labuschke" <michael@labuschke.de>

mdopen.c

index 53b84e4c27cea941ac4581976fb7aa40fc325f95..ce3a12e8c2fff377a83a073a0884ef884044b77a 100644 (file)
--- a/mdopen.c
+++ b/mdopen.c
@@ -44,7 +44,8 @@ void make_dev_symlink(char *dev)
                strcpy(new+7, new+8);
        else
                new[7] = '_';
-       symlink(dev+5, new);
+       if (symlink(dev+5, new))
+               perror(new);
 }
 
 
@@ -249,8 +250,10 @@ int open_mddev(char *dev, int autof)
 
                        if (strncmp(dev, "/dev/md/", 8) == 0) {
                                if (mkdir("/dev/md",0700)==0) {
-                                       chown("/dev/md", ci->uid, ci->gid);
-                                       chmod("/dev/md", ci->mode| ((ci->mode>>2) & 0111));
+                                       if (chown("/dev/md", ci->uid, ci->gid))
+                                               perror("chown /dev/md");
+                                       if (chmod("/dev/md", ci->mode| ((ci->mode>>2) & 0111)))
+                                               perror("chmod /dev/md");
                                }
                        }
                        if (mknod(dev, S_IFBLK|0600, makedev(major, minor))!= 0) {