[PATCH] src/t_ofd_locks.c: Reset errno to zero

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



It seems I met libcap errno bug again when using libcap-2.48-4.el8.x86_64.
But this time, errno is EINVAL if c program link with lcap.
Lastest upstream libcap doesn't have bug and it should be backport bug.

generic/478 will become not run because of this. To fix this that only
exists on some distributions, reset errno to zero.

Signed-off-by: Yang Xu <xuyang2018.jy@xxxxxxxxxxx>
---
 src/t_ofd_locks.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/t_ofd_locks.c b/src/t_ofd_locks.c
index e3b15ddc..e77f2659 100644
--- a/src/t_ofd_locks.c
+++ b/src/t_ofd_locks.c
@@ -187,6 +187,8 @@ int main(int argc, char **argv)
 	struct sembuf sop;
 	int opt, ret, retry;
 
+	//avoid libcap errno bug
+	errno = 0;
 	while((opt = getopt(argc, argv, "sgrwo:l:PRWtFd")) != -1) {
 		switch(opt) {
 		case 's':
-- 
2.27.0




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux