chiark / gitweb /
[PATCH] no error on enoent
authormd@Linux.IT <md@Linux.IT>
Tue, 2 Mar 2004 06:34:12 +0000 (22:34 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:35:06 +0000 (21:35 -0700)
no_error_on_enoent: do not exit with an error and delete all files
when a device or directory does not exist.

udev-remove.c

index e62d1fb..dcd460b 100644 (file)
@@ -51,6 +51,8 @@ static int delete_path(char *path)
 
                /* remove if empty */
                retval = rmdir(path);
+               if (errno == ENOENT)
+                       retval = 0;
                if (retval) {
                        if (errno == ENOTEMPTY)
                                return 0;
@@ -77,6 +79,8 @@ static int delete_node(struct udevice *dev)
 
        info("removing device node '%s'", filename);
        retval = unlink(filename);
+       if (errno == ENOENT)
+               retval = 0;
        if (retval) {
                dbg("unlink(%s) failed with error '%s'",
                        filename, strerror(errno));
@@ -109,6 +113,8 @@ static int delete_node(struct udevice *dev)
 
                        dbg("unlinking symlink '%s'", filename);
                        retval = unlink(filename);
+                       if (errno == ENOENT)
+                               retval = 0;
                        if (retval) {
                                dbg("unlink(%s) failed with error '%s'",
                                        filename, strerror(errno));