From 9b86bbccb371026d0ce7ab9a2ce685b1fae8a717 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Tue, 15 Jan 2019 16:11:48 -0500 Subject: [PATCH] util: Modify virStorageFileGetSCSIKey return MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Alter the "real" code to return -2 on virCommandRun failure. Alter the comments and function header to describe the function and its returns. Signed-off-by: John Ferlan ACKed-by: Michal Privoznik Reviewed-by: Ján Tomko --- src/util/virstoragefile.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index da8e54e0f0..2fc8ed840e 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1425,8 +1425,22 @@ int virStorageFileGetLVMKey(const char *path, #endif #ifdef WITH_UDEV -int virStorageFileGetSCSIKey(const char *path, - char **key) +/* virStorageFileGetSCSIKey + * @path: Path to the SCSI device + * @key: Unique key to be returned + * + * Using a udev specific function, query the @path to get and return a + * unique @key for the caller to use. + * + * Returns: + * 0 On success, with the @key filled in or @key=NULL if the + * returned string was empty. + * -1 When WITH_UDEV is undefined and a system error is reported + * -2 When WITH_UDEV is defined, but calling virCommandRun fails + */ +int +virStorageFileGetSCSIKey(const char *path, + char **key) { int status; virCommandPtr cmd = virCommandNewArgList("/lib/udev/scsi_id", @@ -1435,7 +1449,7 @@ int virStorageFileGetSCSIKey(const char *path, "--device", path, NULL ); - int ret = -1; + int ret = -2; *key = NULL; -- 2.47.2