From: Arshad Hussain Date: Mon, 22 Jan 2024 10:33:02 +0000 (+0530) Subject: LU-17000 utils: In mydaemon() check after calling open() X-Git-Tag: 2.15.61~57 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F53758%2F2;p=fs%2Flustre-release.git LU-17000 utils: In mydaemon() check after calling open() This patch adds check after calling open() in function mydaemon() instead of directly using the value Test-Parameters: trivial kerberos=true testlist=sanity-krb5 CoverityID: 397666 ("Argument cannot be negative") Fixes: d2d56f38da0 ("make HEAD from b_post_cmd3") Signed-off-by: Arshad Hussain Change-Id: Ic59414977029221e8618c5bb3320e95d39d9cded Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53758 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Sebastien Buisson Reviewed-by: Andreas Dilger Reviewed-by: Timothy Day Reviewed-by: Oleg Drokin --- diff --git a/lustre/utils/gss/svcgssd.c b/lustre/utils/gss/svcgssd.c index cdaf4ab..3b6cf2e 100644 --- a/lustre/utils/gss/svcgssd.c +++ b/lustre/utils/gss/svcgssd.c @@ -143,6 +143,11 @@ mydaemon(int nochdir, int noclose) if (noclose == 0) { tempfd = open("/dev/null", O_RDWR); + if (tempfd < 0) { + printerr(LL_ERR, "%s: open() failed: errno %d (%s)\n", + __func__, errno, strerror(errno)); + exit(1); + } dup2(tempfd, 0); dup2(tempfd, 1); dup2(tempfd, 2);