1
0
mirror of https://github.com/systemd/systemd.git synced 2025-08-25 13:49:55 +03:00

Merge pull request #28226 from mrc0mmand/coverity-fixes

A couple of Coverity-related fixes
This commit is contained in:
Luca Boccassi
2023-07-02 15:54:56 +01:00
committed by GitHub
9 changed files with 9 additions and 15 deletions

View File

@ -1095,7 +1095,7 @@ pid_t getpid_cached(void) {
* https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c579f48edba88380635ab98cb612030e3ed8691e
*/
__atomic_compare_exchange_n(
(void) __atomic_compare_exchange_n(
&cached_pid,
&current_value,
CACHED_PID_BUSY,

View File

@ -492,8 +492,6 @@ Virtualization detect_vm(void) {
return xen_dom0;
if (xen_dom0 == 0)
goto finish;
v = VIRTUALIZATION_NONE;
} else if (v != VIRTUALIZATION_NONE)
assert_not_reached();

View File

@ -2880,9 +2880,7 @@ int unit_watch_pid(Unit *u, pid_t pid, bool exclusive) {
if (array[n] == u)
found = true;
if (found) /* Found it already? if so, do nothing */
r = 0;
else {
if (!found) {
Unit **new_array;
/* Allocate a new array */

View File

@ -1013,7 +1013,7 @@ _public_ sd_device *sd_device_get_child_next(sd_device *device, const char **ret
assert(device);
hashmap_iterate(device->children, &device->children_iterator, (void**) &child, (const void**) ret_suffix);
(void) hashmap_iterate(device->children, &device->children_iterator, (void**) &child, (const void**) ret_suffix);
return child;
}

View File

@ -21,17 +21,17 @@ int main(int argc, char *argv[]) {
x = mkostemp_safe(px);
assert_se(x >= 0);
unlink(px);
(void) unlink(px);
assert_se(fx = mmap_cache_add_fd(m, x, PROT_READ));
y = mkostemp_safe(py);
assert_se(y >= 0);
unlink(py);
(void) unlink(py);
z = mkostemp_safe(pz);
assert_se(z >= 0);
unlink(pz);
(void) unlink(pz);
r = mmap_cache_fd_get(fx, 0, false, 1, 2, NULL, &p);
assert_se(r >= 0);

View File

@ -419,7 +419,7 @@ static void test_exec_privatetmp(Manager *m) {
test(m, "exec-privatetmp-no.service", 0, CLD_EXITED);
test(m, "exec-privatetmp-disabled-by-prefix.service", can_unshare ? 0 : MANAGER_IS_SYSTEM(m) ? EXIT_FAILURE : EXIT_NAMESPACE, CLD_EXITED);
unlink("/tmp/test-exec_privatetmp");
(void) unlink("/tmp/test-exec_privatetmp");
}
static void test_exec_privatedevices(Manager *m) {

View File

@ -37,7 +37,7 @@ TEST(sparse_write) {
fd = mkostemp(fn, O_CLOEXEC);
assert_se(fd >= 0);
unlink(fn);
(void) unlink(fn);
test_sparse_write_one(fd, test_a, sizeof(test_a));
test_sparse_write_one(fd, test_b, sizeof(test_b));

View File

@ -23,8 +23,6 @@ int main(int argc, char *argv[]) {
r = watchdog_setup(t);
if (r < 0)
log_warning_errno(r, "Failed to open watchdog: %m");
if (r == -EPERM)
t = 0;
for (i = 0; i < count; i++) {
t = watchdog_runtime_wait();

View File

@ -51,7 +51,7 @@ int udev_watch_restore(int inotify_fd) {
assert(inotify_fd >= 0);
rm_rf("/run/udev/watch.old", REMOVE_ROOT);
(void) rm_rf("/run/udev/watch.old", REMOVE_ROOT);
if (rename("/run/udev/watch", "/run/udev/watch.old") < 0) {
if (errno == ENOENT)