summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
892213b)
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.
#endif
r = sd_notify(unset, msg);
#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);
return NULL;
return PyBool_FromLong(r);
#endif
r = sd_listen_fds(unset);
#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);
return NULL;
return long_FromLong(r);
#endif
r = sd_is_fifo(fd, path);
#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);
return NULL;
return PyBool_FromLong(r);
#endif
r = sd_is_mq(fd, path);
#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);
return NULL;
return PyBool_FromLong(r);
return NULL;
r = sd_is_socket(fd, family, type, listening);
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);
return NULL;
return PyBool_FromLong(r);
}
r = sd_is_socket_inet(fd, family, type, listening, (uint16_t) port);
}
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);
return NULL;
return PyBool_FromLong(r);
#endif
r = sd_is_socket_unix(fd, type, listening, path, length);
#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);
return NULL;
return PyBool_FromLong(r);
"See man:sd_journal_reliable_fd(3).");
static PyObject* Reader_reliable_fd(Reader *self, PyObject *args) {
int r = sd_journal_reliable_fd(self->j);
"See man:sd_journal_reliable_fd(3).");
static PyObject* Reader_reliable_fd(Reader *self, PyObject *args) {
int r = sd_journal_reliable_fd(self->j);
- set_error(r, NULL, NULL);
- if (r < 0)
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return PyBool_FromLong(r);
}
return NULL;
return PyBool_FromLong(r);
}
"See man:sd_journal_get_events(3) for further discussion.");
static PyObject* Reader_get_events(Reader *self, PyObject *args) {
int r = sd_journal_get_events(self->j);
"See man:sd_journal_get_events(3) for further discussion.");
static PyObject* Reader_get_events(Reader *self, PyObject *args) {
int r = sd_journal_get_events(self->j);
- set_error(r, NULL, NULL);
- if (r < 0)
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return long_FromLong(r);
}
return NULL;
return long_FromLong(r);
}
uint64_t t;
r = sd_journal_get_timeout(self->j, &t);
uint64_t t;
r = sd_journal_get_timeout(self->j, &t);
- set_error(r, NULL, NULL);
- if (r < 0)
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
if (t == (uint64_t) -1)
return NULL;
if (t == (uint64_t) -1)
uint64_t t;
r = sd_journal_get_timeout(self->j, &t);
uint64_t t;
r = sd_journal_get_timeout(self->j, &t);
- set_error(r, NULL, NULL);
- if (r < 0)
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return absolute_timeout(t);
return NULL;
return absolute_timeout(t);
uint64_t bytes;
r = sd_journal_get_usage(self->j, &bytes);
uint64_t bytes;
r = sd_journal_get_usage(self->j, &bytes);
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
assert_cc(sizeof(unsigned long long) == sizeof(bytes));
return NULL;
assert_cc(sizeof(unsigned long long) == sizeof(bytes));
assert_not_reached("should not be here");
Py_END_ALLOW_THREADS
assert_not_reached("should not be here");
Py_END_ALLOW_THREADS
- set_error(r, NULL, NULL);
- if (r < 0)
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return PyBool_FromLong(r);
}
return NULL;
return PyBool_FromLong(r);
}
if (r == -ENOENT) {
PyErr_SetString(PyExc_KeyError, field);
return NULL;
if (r == -ENOENT) {
PyErr_SetString(PyExc_KeyError, field);
return NULL;
- } else if (set_error(r, NULL, "field name is not valid"))
+ }
+ if (set_error(r, NULL, "field name is not valid") < 0)
return NULL;
r = extract(msg, msg_len, NULL, &value);
return NULL;
r = extract(msg, msg_len, NULL, &value);
assert(!args);
r = sd_journal_get_realtime_usec(self->j, ×tamp);
assert(!args);
r = sd_journal_get_realtime_usec(self->j, ×tamp);
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
assert_cc(sizeof(unsigned long long) == sizeof(timestamp));
return NULL;
assert_cc(sizeof(unsigned long long) == sizeof(timestamp));
assert(!args);
r = sd_journal_get_monotonic_usec(self->j, ×tamp, &id);
assert(!args);
r = sd_journal_get_monotonic_usec(self->j, ×tamp, &id);
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
assert_cc(sizeof(unsigned long long) == sizeof(timestamp));
return NULL;
assert_cc(sizeof(unsigned long long) == sizeof(timestamp));
return NULL;
r = sd_journal_add_match(self->j, match, match_len);
return NULL;
r = sd_journal_add_match(self->j, match, match_len);
- set_error(r, NULL, "Invalid match");
- if (r < 0)
+ if (set_error(r, NULL, "Invalid match") < 0)
return NULL;
Py_RETURN_NONE;
return NULL;
Py_RETURN_NONE;
static PyObject* Reader_add_disjunction(Reader *self, PyObject *args) {
int r;
r = sd_journal_add_disjunction(self->j);
static PyObject* Reader_add_disjunction(Reader *self, PyObject *args) {
int r;
r = sd_journal_add_disjunction(self->j);
- set_error(r, NULL, NULL);
- if (r < 0)
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
Py_RETURN_NONE;
}
return NULL;
Py_RETURN_NONE;
}
static PyObject* Reader_add_conjunction(Reader *self, PyObject *args) {
int r;
r = sd_journal_add_conjunction(self->j);
static PyObject* Reader_add_conjunction(Reader *self, PyObject *args) {
int r;
r = sd_journal_add_conjunction(self->j);
- set_error(r, NULL, NULL);
- if (r < 0)
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
Py_RETURN_NONE;
}
return NULL;
Py_RETURN_NONE;
}
Py_BEGIN_ALLOW_THREADS
r = sd_journal_seek_head(self->j);
Py_END_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
r = sd_journal_seek_head(self->j);
Py_END_ALLOW_THREADS
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
Py_RETURN_NONE;
}
return NULL;
Py_RETURN_NONE;
}
Py_BEGIN_ALLOW_THREADS
r = sd_journal_seek_tail(self->j);
Py_END_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
r = sd_journal_seek_tail(self->j);
Py_END_ALLOW_THREADS
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
Py_RETURN_NONE;
}
return NULL;
Py_RETURN_NONE;
}
Py_BEGIN_ALLOW_THREADS
r = sd_journal_seek_realtime_usec(self->j, timestamp);
Py_END_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
r = sd_journal_seek_realtime_usec(self->j, timestamp);
Py_END_ALLOW_THREADS
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
Py_RETURN_NONE;
}
return NULL;
Py_RETURN_NONE;
}
if (bootid) {
r = sd_id128_from_string(bootid, &id);
if (bootid) {
r = sd_id128_from_string(bootid, &id);
- if (set_error(r, NULL, "Invalid bootid"))
+ if (set_error(r, NULL, "Invalid bootid") < 0)
return NULL;
} else {
Py_BEGIN_ALLOW_THREADS
r = sd_id128_get_boot(&id);
Py_END_ALLOW_THREADS
return NULL;
} else {
Py_BEGIN_ALLOW_THREADS
r = sd_id128_get_boot(&id);
Py_END_ALLOW_THREADS
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
}
Py_BEGIN_ALLOW_THREADS
r = sd_journal_seek_monotonic_usec(self->j, id, timestamp);
Py_END_ALLOW_THREADS
return NULL;
}
Py_BEGIN_ALLOW_THREADS
r = sd_journal_seek_monotonic_usec(self->j, id, timestamp);
Py_END_ALLOW_THREADS
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
Py_RETURN_NONE;
return NULL;
Py_RETURN_NONE;
Py_BEGIN_ALLOW_THREADS
r = sd_journal_seek_cursor(self->j, cursor);
Py_END_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
r = sd_journal_seek_cursor(self->j, cursor);
Py_END_ALLOW_THREADS
- if (set_error(r, NULL, "Invalid cursor"))
+ if (set_error(r, NULL, "Invalid cursor") < 0)
return NULL;
Py_RETURN_NONE;
}
return NULL;
Py_RETURN_NONE;
}
assert(!args);
r = sd_journal_get_cursor(self->j, &cursor);
assert(!args);
r = sd_journal_get_cursor(self->j, &cursor);
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return unicode_FromString(cursor);
return NULL;
return unicode_FromString(cursor);
return NULL;
r = sd_journal_test_cursor(self->j, cursor);
return NULL;
r = sd_journal_test_cursor(self->j, cursor);
- set_error(r, NULL, NULL);
- if (r < 0)
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return PyBool_FromLong(r);
return NULL;
return PyBool_FromLong(r);
Py_BEGIN_ALLOW_THREADS
r = sd_journal_query_unique(self->j, query);
Py_END_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
r = sd_journal_query_unique(self->j, query);
Py_END_ALLOW_THREADS
- if (set_error(r, NULL, "Invalid field name"))
+ if (set_error(r, NULL, "Invalid field name") < 0)
return NULL;
value_set = PySet_New(0);
return NULL;
value_set = PySet_New(0);
else
set_error(r, NULL, NULL);
return NULL;
else
set_error(r, NULL, NULL);
return NULL;
- } else if (set_error(r, NULL, NULL))
+ }
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return unicode_FromString(msg);
return NULL;
return unicode_FromString(msg);
return NULL;
r = sd_id128_from_string(id_, &id);
return NULL;
r = sd_id128_from_string(id_, &id);
- if (set_error(r, NULL, "Invalid id128"))
+ if (set_error(r, NULL, "Invalid id128") < 0)
return NULL;
Py_BEGIN_ALLOW_THREADS
r = sd_journal_get_catalog_for_message_id(id, &msg);
Py_END_ALLOW_THREADS
return NULL;
Py_BEGIN_ALLOW_THREADS
r = sd_journal_get_catalog_for_message_id(id, &msg);
Py_END_ALLOW_THREADS
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return unicode_FromString(msg);
return NULL;
return unicode_FromString(msg);
int r;
r = sd_journal_get_data_threshold(self->j, &cvalue);
int r;
r = sd_journal_get_data_threshold(self->j, &cvalue);
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return long_FromSize_t(cvalue);
return NULL;
return long_FromSize_t(cvalue);