X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fudev%2Fudevadm-test-builtin.c;h=f4aa21ee72fcc95fcd8d185ca0d68a63bd22fec6;hb=a50d7d4389217c0d3b527ee260eabf89e4a76caa;hp=e63b1f4eb7bc2dff065b27fd6a8b8c317255ddc4;hpb=6ada823a9a0979ea145fd70add1007c21caa45c0;p=elogind.git diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c index e63b1f4eb..f4aa21ee7 100644 --- a/src/udev/udevadm-test-builtin.c +++ b/src/udev/udevadm-test-builtin.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Kay Sievers + * Copyright (C) 2011 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 @@ -95,10 +95,10 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) } /* add /sys if needed */ - if (strncmp(syspath, "/sys", strlen("/sys")) != 0) - util_strscpyl(filename, sizeof(filename), "/sys", syspath, NULL); + if (!startswith(syspath, "/sys")) + strscpyl(filename, sizeof(filename), "/sys", syspath, NULL); else - util_strscpy(filename, sizeof(filename), syspath); + strscpy(filename, sizeof(filename), syspath); util_remove_trailing_chars(filename, '/'); dev = udev_device_new_from_syspath(udev, filename); @@ -108,8 +108,9 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) goto out; } - if (udev_builtin_run(dev, cmd, command, true) < 0) { - fprintf(stderr, "error executing '%s'\n\n", command); + rc = udev_builtin_run(dev, cmd, command, true); + if (rc < 0) { + fprintf(stderr, "error executing '%s', exit code %i\n\n", command, rc); rc = 6; } out: