summaryrefslogtreecommitdiff
path: root/src/python-systemd/_daemon.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-29 23:39:28 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-30 00:17:15 -0500
commitb560cc1c45006a98c7652435df13c96b39827f22 (patch)
tree6ebfdf010c77424cb84aa4b31fdf6ac6fe4a11c1 /src/python-systemd/_daemon.c
parent892213bf1fd23e48d64a407ece6e10b07bef1926 (diff)
systemd-python: fix setting of exception codes
The return value of 0 would be treated as failure by mistake, resulting in " SystemError: error return without exception set". The way that set_error() is used is changed to be the same everywhere.
Diffstat (limited to 'src/python-systemd/_daemon.c')
-rw-r--r--src/python-systemd/_daemon.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/python-systemd/_daemon.c b/src/python-systemd/_daemon.c
index f0ab16f659..c6db69fe26 100644
--- a/src/python-systemd/_daemon.c
+++ b/src/python-systemd/_daemon.c
@@ -88,7 +88,7 @@ static PyObject* notify(PyObject *self, PyObject *args, PyObject *keywds) {
#endif
r = sd_notify(unset, msg);
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return PyBool_FromLong(r);
@@ -123,7 +123,7 @@ static PyObject* listen_fds(PyObject *self, PyObject *args, PyObject *keywds) {
#endif
r = sd_listen_fds(unset);
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return long_FromLong(r);
@@ -151,7 +151,7 @@ static PyObject* is_fifo(PyObject *self, PyObject *args) {
#endif
r = sd_is_fifo(fd, path);
- if (set_error(r, path, NULL))
+ if (set_error(r, path, NULL) < 0)
return NULL;
return PyBool_FromLong(r);
@@ -179,7 +179,7 @@ static PyObject* is_mq(PyObject *self, PyObject *args) {
#endif
r = sd_is_mq(fd, path);
- if (set_error(r, path, NULL))
+ if (set_error(r, path, NULL) < 0)
return NULL;
return PyBool_FromLong(r);
@@ -203,7 +203,7 @@ static PyObject* is_socket(PyObject *self, PyObject *args) {
return NULL;
r = sd_is_socket(fd, family, type, listening);
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return PyBool_FromLong(r);
@@ -230,7 +230,7 @@ static PyObject* is_socket_inet(PyObject *self, PyObject *args) {
}
r = sd_is_socket_inet(fd, family, type, listening, (uint16_t) port);
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return PyBool_FromLong(r);
@@ -265,7 +265,7 @@ static PyObject* is_socket_unix(PyObject *self, PyObject *args) {
#endif
r = sd_is_socket_unix(fd, type, listening, path, length);
- if (set_error(r, path, NULL))
+ if (set_error(r, path, NULL) < 0)
return NULL;
return PyBool_FromLong(r);