summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-08-17 10:10:04 +0200
committerDaniel Mack <github@zonque.org>2015-08-17 10:10:04 +0200
commite503467fa021a46b244cf4c012a4485167cca4d0 (patch)
treea681cefaa50a1a00e40be257b13c2fa6ac6b63e1 /src/libsystemd
parent4fe66a7155a183308d5e323d303f494d7b135b87 (diff)
parent8ac43fee1a2890d62edfe29282f66780bc1b634f (diff)
Merge pull request #953 from poettering/ebadf
tree-wide: generate EBADF when we get invalid fds
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-bus/bus-message.c4
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c4
-rw-r--r--src/libsystemd/sd-event/sd-event.c4
-rw-r--r--src/libsystemd/sd-login/sd-login.c14
-rw-r--r--src/libsystemd/sd-netlink/sd-netlink.c2
5 files changed, 14 insertions, 14 deletions
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index b0577cc412..b52285403f 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -2686,7 +2686,7 @@ _public_ int sd_bus_message_append_array_memfd(
int r;
assert_return(m, -EINVAL);
- assert_return(memfd >= 0, -EINVAL);
+ assert_return(memfd >= 0, -EBADF);
assert_return(bus_type_is_trivial(type), -EINVAL);
assert_return(size > 0, -EINVAL);
assert_return(!m->sealed, -EPERM);
@@ -2762,7 +2762,7 @@ _public_ int sd_bus_message_append_string_memfd(
int r;
assert_return(m, -EINVAL);
- assert_return(memfd >= 0, -EINVAL);
+ assert_return(memfd >= 0, -EBADF);
assert_return(size > 0, -EINVAL);
assert_return(!m->sealed, -EPERM);
assert_return(!m->poisoned, -ESTALE);
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index b9e2782564..db4f21e9ff 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -213,8 +213,8 @@ _public_ int sd_bus_set_address(sd_bus *bus, const char *address) {
_public_ int sd_bus_set_fd(sd_bus *bus, int input_fd, int output_fd) {
assert_return(bus, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
- assert_return(input_fd >= 0, -EINVAL);
- assert_return(output_fd >= 0, -EINVAL);
+ assert_return(input_fd >= 0, -EBADF);
+ assert_return(output_fd >= 0, -EBADF);
assert_return(!bus_pid_changed(bus), -ECHILD);
bus->input_fd = input_fd;
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index 754fb7614e..0e33ced342 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -816,7 +816,7 @@ _public_ int sd_event_add_io(
int r;
assert_return(e, -EINVAL);
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(!(events & ~(EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLPRI|EPOLLERR|EPOLLHUP|EPOLLET)), -EINVAL);
assert_return(callback, -EINVAL);
assert_return(e->state != SD_EVENT_FINISHED, -ESTALE);
@@ -1311,7 +1311,7 @@ _public_ int sd_event_source_set_io_fd(sd_event_source *s, int fd) {
int r;
assert_return(s, -EINVAL);
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(s->type == SOURCE_IO, -EDOM);
assert_return(!event_pid_changed(s->event), -ECHILD);
diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c
index e3885ecba6..9bbf8974dd 100644
--- a/src/libsystemd/sd-login/sd-login.c
+++ b/src/libsystemd/sd-login/sd-login.c
@@ -94,7 +94,7 @@ _public_ int sd_peer_get_session(int fd, char **session) {
struct ucred ucred = {};
int r;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(session, -EINVAL);
r = getpeercred(fd, &ucred);
@@ -108,7 +108,7 @@ _public_ int sd_peer_get_owner_uid(int fd, uid_t *uid) {
struct ucred ucred;
int r;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(uid, -EINVAL);
r = getpeercred(fd, &ucred);
@@ -122,7 +122,7 @@ _public_ int sd_peer_get_unit(int fd, char **unit) {
struct ucred ucred;
int r;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(unit, -EINVAL);
r = getpeercred(fd, &ucred);
@@ -136,7 +136,7 @@ _public_ int sd_peer_get_user_unit(int fd, char **unit) {
struct ucred ucred;
int r;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(unit, -EINVAL);
r = getpeercred(fd, &ucred);
@@ -150,7 +150,7 @@ _public_ int sd_peer_get_machine_name(int fd, char **machine) {
struct ucred ucred;
int r;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(machine, -EINVAL);
r = getpeercred(fd, &ucred);
@@ -164,7 +164,7 @@ _public_ int sd_peer_get_slice(int fd, char **slice) {
struct ucred ucred;
int r;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(slice, -EINVAL);
r = getpeercred(fd, &ucred);
@@ -178,7 +178,7 @@ _public_ int sd_peer_get_user_slice(int fd, char **slice) {
struct ucred ucred;
int r;
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
assert_return(slice, -EINVAL);
r = getpeercred(fd, &ucred);
diff --git a/src/libsystemd/sd-netlink/sd-netlink.c b/src/libsystemd/sd-netlink/sd-netlink.c
index c413b1c266..d248869c8d 100644
--- a/src/libsystemd/sd-netlink/sd-netlink.c
+++ b/src/libsystemd/sd-netlink/sd-netlink.c
@@ -106,7 +106,7 @@ int sd_netlink_open_fd(sd_netlink **ret, int fd) {
int r;
assert_return(ret, -EINVAL);
- assert_return(fd >= 0, -EINVAL);
+ assert_return(fd >= 0, -EBADF);
r = sd_netlink_new(&rtnl);
if (r < 0)