X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=extras%2Fvolume_id%2Fvol_id.c;h=b3f810fc9d3d6082af10e4ad8e1a132fcc44c617;hb=f46a8a98a79afcbb9e9910d7d71c1f8ef4e6637f;hp=04e85abb7f8bd02bd69a59ad09a0d112de0bfe5d;hpb=8b5238670d2e741bc71ae3e79b499682965dc2fd;p=elogind.git diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 04e85abb7..b3f810fc9 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -34,7 +34,7 @@ #include #include -#include "../../udev.h" +#include "../../udev/udev.h" #include "lib/libvolume_id.h" #define BLKGETSIZE64 _IOR(0x12,114,size_t) @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) { "export", 0, NULL, 'x' }, { "skip-raid", 0, NULL, 's' }, { "probe-all", 0, NULL, 'a' }, - { "offset", 1, NULL, 'o' }, + { "offset", 2, NULL, 'o' }, { "help", 0, NULL, 'h' }, {} }; @@ -196,7 +196,8 @@ int main(int argc, char *argv[]) probe_all = 1; break; case 'o': - offset = strtoull(optarg, NULL, 0); + if (optarg[0] != '\0') + offset = strtoull(optarg, NULL, 0); break; case 'h': printf("Usage: vol_id [options] \n" @@ -218,7 +219,7 @@ int main(int argc, char *argv[]) node = argv[optind]; if (!node) { - err("no device"); + err("no device\n"); fprintf(stderr, "no device\n"); rc = 1; goto exit; @@ -239,7 +240,7 @@ int main(int argc, char *argv[]) if (ioctl(fd, BLKGETSIZE64, &size) != 0) size = 0; - dbg("BLKGETSIZE64=%llu", (unsigned long long)size); + dbg("BLKGETSIZE64=%llu\n", (unsigned long long)size); /* try to drop all privileges before reading disk content */ if (getuid() == 0) { @@ -250,7 +251,7 @@ int main(int argc, char *argv[]) if (setgroups(0, NULL) != 0 || setgid(pw->pw_gid) != 0 || setuid(pw->pw_uid) != 0) - info("unable to drop privileges: %s\n", strerror(errno)); + info("unable to drop privileges: %s\n\n", strerror(errno)); } }