From 68c88d942fe9b5ccc728c0a1494aa7571eb49a1a Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 3 Feb 2011 12:59:58 +0100 Subject: [PATCH] blkid: add new return code 8 for ambivalent low-level probing result Signed-off-by: Karel Zak --- misc-utils/blkid.8 | 10 ++++++++-- misc-utils/blkid.c | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/misc-utils/blkid.8 b/misc-utils/blkid.8 index 746ed39ee5..05711ca8a9 100644 --- a/misc-utils/blkid.8 +++ b/misc-utils/blkid.8 @@ -253,9 +253,15 @@ appear in are shown, if they are recognized. .SH "RETURN CODE" If the specified token was found, or if any tags were shown from (specified) -devices, 0 is returned. If the specified token was not found, or no -(specified) devices could be identified, an exit code of 2 is returned. +devices, 0 is returned. + +If the specified token was not found, or no (specified) devices could be +identified an exit code of 2 is returned. + For usage or other errors, an exit code of 4 is returned. + +If the ambivalent low-level probing result was detected an exit code of 8 is +returned. .SH AUTHOR .B blkid was written by Andreas Dilger for libblkid and improved by Theodore Ts'o diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 4c846e93d1..53f2a69e62 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -565,7 +565,13 @@ done: devname); } close(fd); - return !nvals ? 2 : 0; + + if (rc == -2) + return 8; /* ambivalent probing result */ + if (!nvals) + return 2; /* nothing detected */ + + return 0; /* sucess */ } /* converts comma separated list to BLKID_USAGE_* mask */ -- 2.39.2