summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-08-13 21:54:56 +0300
committerLennart Poettering <lennart@poettering.net>2015-08-13 21:54:56 +0300
commit3326332eb9d4eac00c4e543fcdde9e5c0720c23d (patch)
tree1aee3a06e142416d246e2744da625a2e0ec2070e /src
parentb69c7e104bca80ab11ba2bcd66a2e1fe2a701020 (diff)
parente6803801686c7dbd2173ca07e1be38886be918c5 (diff)
Merge pull request #907 from keszybz/sd-daemon-badf
sd-daemon: return EBADF for invalid fd numbers
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-daemon/sd-daemon.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libsystemd/sd-daemon/sd-daemon.c b/src/libsystemd/sd-daemon/sd-daemon.c
index 82ac72c72a..d230a48daf 100644
--- a/src/libsystemd/sd-daemon/sd-daemon.c
+++ b/src/libsystemd/sd-daemon/sd-daemon.c
@@ -90,7 +90,7 @@ finish:
_public_ int sd_is_fifo(int fd, const char *path) {
struct stat st_fd;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
if (fstat(fd, &st_fd) < 0)
return -errno;
@@ -120,7 +120,7 @@ _public_ int sd_is_fifo(int fd, const char *path) {
_public_ int sd_is_special(int fd, const char *path) {
struct stat st_fd;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
if (fstat(fd, &st_fd) < 0)
return -errno;
@@ -155,7 +155,7 @@ _public_ int sd_is_special(int fd, const char *path) {
static int sd_is_socket_internal(int fd, int type, int listening) {
struct stat st_fd;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(type >= 0, -EINVAL);
if (fstat(fd, &st_fd) < 0)
@@ -198,7 +198,7 @@ static int sd_is_socket_internal(int fd, int type, int listening) {
_public_ int sd_is_socket(int fd, int family, int type, int listening) {
int r;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(family >= 0, -EINVAL);
r = sd_is_socket_internal(fd, type, listening);
@@ -226,7 +226,7 @@ _public_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint
socklen_t l = sizeof(sockaddr);
int r;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(IN_SET(family, 0, AF_INET, AF_INET6), -EINVAL);
r = sd_is_socket_internal(fd, type, listening);
@@ -269,7 +269,7 @@ _public_ int sd_is_socket_unix(int fd, int type, int listening, const char *path
socklen_t l = sizeof(sockaddr);
int r;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
r = sd_is_socket_internal(fd, type, listening);
if (r <= 0)
@@ -310,7 +310,7 @@ _public_ int sd_is_socket_unix(int fd, int type, int listening, const char *path
_public_ int sd_is_mq(int fd, const char *path) {
struct mq_attr attr;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
if (mq_getattr(fd, &attr) < 0)
return -errno;