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;
}
}
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);
break;
case 'h':
printf("Usage: firmware --firmware=<fwfile> --devpath=<path> [--help]\n\n");
- default:
- rc = 1;
goto exit;
}
}
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;
break;
case 'h':
usage(NULL);
- default:
- exit(1);
}
}
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;
}
}
break;
case 'h':
printf("Usage: udev-acl --action=ACTION [--device=DEVICEFILE] [--user=UID]\n\n");
- default:
goto out;
}
}
" --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;
}
}
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;
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;
" --subsystem-match=<subsystem[/devtype]> filter events by subsystem\n"
" --tag-match=<tag> filter events by tag\n"
" --help\n\n");
- default:
goto out;
}
}
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);