X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev%2Fudevadm-test.c;h=f4b0125d3cdbf28d2e39fb6975aca820dd6460b4;hb=98f10a9e2ada5d72a0c39b94a5b59d9da4f28753;hp=0f7d5dbe73563a36a2e0addfa11c17b1fed9465c;hpb=7d563a17f3967890331daf08d43f2f005418139b;p=elogind.git diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 0f7d5dbe7..f4b0125d3 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -1,20 +1,19 @@ /* * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #include @@ -34,7 +33,7 @@ static int import_uevent_var(struct udev *udev, const char *devpath) { - char path[PATH_SIZE]; + char path[UTIL_PATH_SIZE]; static char value[4096]; /* must stay, used with putenv */ ssize_t size; int fd; @@ -43,9 +42,9 @@ static int import_uevent_var(struct udev *udev, const char *devpath) int rc = -1; /* read uevent file */ - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/uevent", sizeof(path)); + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, devpath, sizeof(path)); + util_strlcat(path, "/uevent", sizeof(path)); fd = open(path, O_RDONLY); if (fd < 0) goto out; @@ -84,10 +83,10 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) int rc = 0; static const struct option options[] = { - { "action", 1, NULL, 'a' }, - { "subsystem", 1, NULL, 's' }, - { "force", 0, NULL, 'f' }, - { "help", 0, NULL, 'h' }, + { "action", required_argument, NULL, 'a' }, + { "subsystem", required_argument, NULL, 's' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, {} }; @@ -164,11 +163,11 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) } if (subsystem != NULL) - strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); + util_strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); /* override built-in sysfs device */ udevice->dev = dev; - strlcpy(udevice->action, action, sizeof(udevice->action)); + util_strlcpy(udevice->action, action, sizeof(udevice->action)); udevice->devt = udev_device_get_devt(udevice); /* simulate node creation with test flag */ @@ -190,9 +189,9 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) struct name_entry *name_loop; list_for_each_entry(name_loop, &udevice->run_list, node) { - char program[PATH_SIZE]; + char program[UTIL_PATH_SIZE]; - strlcpy(program, name_loop->name, sizeof(program)); + util_strlcpy(program, name_loop->name, sizeof(program)); udev_rules_apply_format(udevice, program, sizeof(program)); info(udev, "run: '%s'\n", program); }