Petr Uzel wrote: > Subject: [PATCH 2/2] blkid: introduce symbolic names for different blkid exit codes > > > Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx> > --- > misc-utils/blkid.c | 32 ++++++++++++++++++-------------- > 1 files changed, 18 insertions(+), 14 deletions(-) > > diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c > index 4f7050f..52b2a4b 100644 > --- a/misc-utils/blkid.c > +++ b/misc-utils/blkid.c > @@ -34,11 +34,15 @@ extern int optind; > #define LOWPROBE_TOPOLOGY (1 << 1) > #define LOWPROBE_SUPERBLOCKS (1 << 2) > > +#define BLKID_EXIT_NOTFOUND 2 /* token or device not found */ > +#define BLKID_EXIT_OTHER 4 /* bad usage or other error */ > +#define BLKID_EXIT_AMBIVAL 8 /* ambivalent low-level probing detected */ > + > #include <blkid.h> > > #include "ismounted.h" > > -#define STRTOXX_EXIT_CODE 4 /* strtoxx_or_err() */ > +#define STRTOXX_EXIT_CODE BLKID_EXIT_OTHER /* strtoxx_or_err() */ STRTOXX_EXIT_CODE is not used in blkid.c. Remove it? ... or if it used in strutils.h, then this is not a nice interface. > #include "strutils.h" > #include "closestream.h" > #include "ttyutils.h" > @@ -484,7 +488,7 @@ static int lowprobe_device(blkid_probe pr, const char *devname, > fd = open(devname, O_RDONLY); > if (fd < 0) { > fprintf(stderr, "error: %s: %m\n", devname); > - return 2; > + return BLKID_EXIT_NOTFOUND; > } > if (blkid_probe_set_device(pr, fd, offset, size)) > goto done; > @@ -551,9 +555,9 @@ done: > close(fd); > > if (rc == -2) > - return 8; /* ambivalent probing result */ > + return BLKID_EXIT_AMBIVAL; /* ambivalent probing result */ > if (!nvals) > - return 2; /* nothing detected */ > + return BLKID_EXIT_NOTFOUND; /* nothing detected */ > > return 0; /* success */ > } These are not exit() codes, but return codes. That value doesn't seem to be of much interest anyway, because it's used only here in main() in a for-loop, forgetting the return value of the previous iteration: for (i = 0; i < numdev; i++) err = lowprobe_device(pr, devices[i], lowprobe, show, output_format, (blkid_loff_t) offset, (blkid_loff_t) size); Have a nice day, Berny -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html