Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153439878
D28185.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1005 B
Referenced Files
None
Subscribers
None
D28185.diff
View Options
diff --git a/bin/cat/cat.c b/bin/cat/cat.c
--- a/bin/cat/cat.c
+++ b/bin/cat/cat.c
@@ -429,7 +429,7 @@
struct addrinfo hints, *res, *res0;
char rpath[PATH_MAX];
int fd = -1;
- int error;
+ int error, serrno;
cap_rights_t rights;
/*
@@ -453,18 +453,23 @@
fd = socket(res->ai_family, res->ai_socktype,
res->ai_protocol);
if (fd < 0) {
+ serrno = errno;
freeaddrinfo(res0);
+ errno = serrno;
return (-1);
}
if (caph_rights_limit(fd, &rights) < 0) {
+ serrno = errno;
close(fd);
freeaddrinfo(res0);
+ errno = serrno;
return (-1);
}
error = cap_connect(capnet, fd, res->ai_addr, res->ai_addrlen);
if (error == 0)
break;
else {
+ serrno = errno;
close(fd);
fd = -1;
}
@@ -492,9 +497,13 @@
cap_rights_clear(&rights, CAP_CONNECT, CAP_SHUTDOWN);
if (caph_rights_limit(fd, &rights) < 0) {
+ serrno = errno;
close(fd);
+ errno = serrno;
return (-1);
}
+ } else {
+ errno = serrno;
}
return (fd);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 22, 4:40 AM (16 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31929730
Default Alt Text
D28185.diff (1005 B)
Attached To
Mode
D28185: cat: restore errno
Attached
Detach File
Event Timeline
Log In to Comment