]> err.no Git - util-linux/commitdiff
libblkid: minor changes to samples
authorKarel Zak <kzak@redhat.com>
Mon, 21 Sep 2009 13:39:00 +0000 (15:39 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 21 Sep 2009 13:39:00 +0000 (15:39 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/samples/mkfs.c
shlibs/blkid/samples/partitions.c
shlibs/blkid/samples/topology.c

index 64f213a639256ce03e92f3bbec3153986a10f39d..866ca6e367ca42b0bb415b5c6b50b468eff58ca6 100644 (file)
@@ -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.<type> code or so ...
 
        off = blkid_topology_get_alignment_offset(tp);
 
-
         */
 
+       blkid_free_probe(pr);
+
        return EXIT_SUCCESS;
 }
index 7e2648ab0e7c59d243c876b51a29322217f16f16..8c0004822a417513e42cdf9547478508ba2ffa6f 100644 (file)
@@ -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);
index 665281cdd14e397a07aeecd99271682592ddd6c7..6d3bc82ef9cfabebc91c47ee9282da3f66b63c38 100644 (file)
@@ -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;
 }