From: Karel Zak Date: Mon, 21 Sep 2009 13:39:00 +0000 (+0200) Subject: libblkid: minor changes to samples X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79e1f9f15cea3d81aeea64a89610b6ed72fd310e;p=util-linux libblkid: minor changes to samples Signed-off-by: Karel Zak --- diff --git a/shlibs/blkid/samples/mkfs.c b/shlibs/blkid/samples/mkfs.c index 64f213a6..866ca6e3 100644 --- a/shlibs/blkid/samples/mkfs.c +++ b/shlibs/blkid/samples/mkfs.c @@ -38,14 +38,14 @@ int main(int argc, char *argv[]) fd = open(devname, O_RDONLY); if (fd < 0) - err(EXIT_FAILURE, "%s: open() failed", devname); + errx(EXIT_FAILURE, "%s: open() failed", devname); pr = blkid_new_probe(); if (!pr) - err(EXIT_FAILURE, "faild to allocate a new libblkid probe"); + errx(EXIT_FAILURE, "faild to allocate a new libblkid probe"); if (blkid_probe_set_device(pr, fd, 0, 0) != 0) - err(EXIT_FAILURE, "failed to assign device to libblkid probe"); + errx(EXIT_FAILURE, "failed to assign device to libblkid probe"); /* * check Filesystems / Partitions overwrite @@ -74,15 +74,16 @@ int main(int argc, char *argv[]) */ tp = blkid_probe_get_topology(pr); if (!tp) - err(EXIT_FAILURE, "%s: failed to read topology", devname); + errx(EXIT_FAILURE, "%s: failed to read topology", devname); /* ... your mkfs. code or so ... off = blkid_topology_get_alignment_offset(tp); - */ + blkid_free_probe(pr); + return EXIT_SUCCESS; } diff --git a/shlibs/blkid/samples/partitions.c b/shlibs/blkid/samples/partitions.c index 7e2648ab..8c000482 100644 --- a/shlibs/blkid/samples/partitions.c +++ b/shlibs/blkid/samples/partitions.c @@ -38,10 +38,10 @@ int main(int argc, char *argv[]) pr = blkid_new_probe(); if (!pr) - err(EXIT_FAILURE, "failed to allocate a new libblkid probe"); + errx(EXIT_FAILURE, "failed to allocate a new libblkid probe"); if (blkid_probe_set_device(pr, fd, 0, 0) != 0) - err(EXIT_FAILURE, "failed to assign device to libblkid probe"); + errx(EXIT_FAILURE, "failed to assign device to libblkid probe"); /* Binary interface */ ls = blkid_probe_get_partitions(pr); diff --git a/shlibs/blkid/samples/topology.c b/shlibs/blkid/samples/topology.c index 665281cd..6d3bc82e 100644 --- a/shlibs/blkid/samples/topology.c +++ b/shlibs/blkid/samples/topology.c @@ -42,10 +42,10 @@ int main(int argc, char *argv[]) pr = blkid_new_probe(); if (!pr) - err(EXIT_FAILURE, "faild to allocate a new libblkid probe"); + errx(EXIT_FAILURE, "faild to allocate a new libblkid probe"); if (blkid_probe_set_device(pr, fd, 0, 0) != 0) - err(EXIT_FAILURE, "failed to assign device to libblkid probe"); + errx(EXIT_FAILURE, "failed to assign device to libblkid probe"); /* * Binary interface @@ -89,6 +89,6 @@ int main(int argc, char *argv[]) } } - + blkid_free_probe(pr); return EXIT_SUCCESS; }