]> err.no Git - systemd/commitdiff
trivial cleanups
authorKay Sievers <kay.sievers@vrfy.org>
Tue, 12 Apr 2011 23:47:56 +0000 (01:47 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Tue, 12 Apr 2011 23:47:56 +0000 (01:47 +0200)
extras/ata_id/ata_id.c
extras/firmware/firmware.c
extras/hid2hci/hid2hci.c
extras/path_id/path_id.c
extras/udev-acl/udev-acl.c
extras/usb_id/usb_id.c
libudev/libudev-util-private.c
udev/udevadm-monitor.c
udev/udevd.c

index 594cfb20172490af3994bd965273f488bab350cd..cb4a1a1f075b4a0587f7e953ba29e57ee2fde401 100644 (file)
@@ -486,8 +486,6 @@ int main(int argc, char *argv[])
                        printf("Usage: ata_id [--export] [--help] <device>\n"
                               "  --export    print values as environment keys\n"
                               "  --help      print this help text\n\n");
-               default:
-                       rc = 1;
                        goto exit;
                }
        }
index f2df76c8c54e0d9a7ce5adb015afca49f02bfdc6..36ce79054c2a1c788e700611d9ee3feba087f885 100644 (file)
@@ -43,7 +43,7 @@ static bool set_loading(struct udev *udev, char *loadpath, const char *state)
 static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size)
 {
        char *buf;
-       FILE *fsource, *ftarget;
+       FILE *fsource = NULL, *ftarget = NULL;
        bool ret = false;
 
        buf = malloc(size);
@@ -112,8 +112,6 @@ int main(int argc, char **argv)
                        break;
                case 'h':
                        printf("Usage: firmware --firmware=<fwfile> --devpath=<path> [--help]\n\n");
-               default:
-                       rc = 1;
                        goto exit;
                }
        }
index 839c4fbce76524203fd7c677ad91c617e783b3f0..98e60d9ac16b664791220f87b8999c7c2c563541 100644 (file)
@@ -243,7 +243,7 @@ int main(int argc, char *argv[])
        for (;;) {
                int option;
 
-               option = getopt_long(argc, argv, "m:p:M:qh", options, NULL);
+               option = getopt_long(argc, argv, "m:p:M:h", options, NULL);
                if (option == -1)
                        break;
 
@@ -277,8 +277,6 @@ int main(int argc, char *argv[])
                        break;
                case 'h':
                        usage(NULL);
-               default:
-                       exit(1);
                }
        }
 
index c19bfd0f8d59fae57a74d1ba88ab47748efc6f08..db13eeba273fd0d54d590bd7c069ea65aff46988 100644 (file)
@@ -388,8 +388,6 @@ int main(int argc, char **argv)
                        printf("Usage: path_id [--debug] [--help] <devpath>\n"
                               "  --debug    print debug information\n"
                               "  --help      print this help text\n\n");
-               default:
-                       rc = 1;
                        goto exit;
                }
        }
index 31e9991a51dded24a131409e6dac63cba1a35e2c..2dd3e6cac9bcfd08be8599387c62d74503b07ca6 100644 (file)
@@ -364,7 +364,6 @@ int main (int argc, char* argv[])
                        break;
                case 'h':
                        printf("Usage: udev-acl --action=ACTION [--device=DEVICEFILE] [--user=UID]\n\n");
-               default:
                        goto out;
                }
        }
index fabd09283def1dfda56fc4828731d25e423e0bac..3a7a0ffd496cb61130e85ff504fc9535d2ab8134 100644 (file)
@@ -503,8 +503,6 @@ int main(int argc, char **argv)
                               "  --num-info  use numerical values\n"
                               "  --export    print values as environment keys\n"
                               "  --help      print this help text\n\n");
-               default:
-                       retval = 1;
                        goto exit;
                }
        }
index 19f979eeab725d91e312bec9603ebeea91784387..073f7e2df8fa1b54d28f079ba48b89e3e98232b3 100644 (file)
@@ -134,7 +134,7 @@ int util_unlink_secure(struct udev *udev, const char *filename)
 uid_t util_lookup_user(struct udev *udev, const char *user)
 {
        char *endptr;
-       int buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+       size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
        char buf[buflen];
        struct passwd pwbuf;
        struct passwd *pw;
@@ -159,7 +159,7 @@ uid_t util_lookup_user(struct udev *udev, const char *user)
 gid_t util_lookup_group(struct udev *udev, const char *group)
 {
        char *endptr;
-       int buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+       size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
        char *buf;
        struct group grbuf;
        struct group *gr;
index 85252bb7d98e1bd61f10b4e6809d47053688d127..a587e8cc0f10daf2cf1c44e56d6a78893b85fdae 100644 (file)
@@ -133,7 +133,6 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                               "  --subsystem-match=<subsystem[/devtype]> filter events by subsystem\n"
                               "  --tag-match=<tag>                       filter events by tag\n"
                               "  --help\n\n");
-               default:
                        goto out;
                }
        }
index c785b2075774b12a8ccd443bf3d46799bc9781cb..8610c6c062123da98972667e66ca578afe17cc3a 100644 (file)
@@ -744,9 +744,11 @@ static int handle_inotify(struct udev *udev)
                                info(udev, "device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev));
                                util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
                                fd = open(filename, O_WRONLY);
-                               if (fd < 0 || write(fd, "change", 6) < 0)
-                                       info(udev, "error writing uevent: %m\n");
-                               close(fd);
+                               if (fd >= 0) {
+                                       if (write(fd, "change", 6) < 0)
+                                               info(udev, "error writing uevent: %m\n");
+                                       close(fd);
+                               }
                        }
                        if (ev->mask & IN_IGNORED)
                                udev_watch_end(udev, dev);