Compare commits
No commits in common. "0393e6a2742c5f4ec2903a700a7f41821cd141f2" and "427103f7a627af9a89b5eb470b13c8ff50ca43ae" have entirely different histories.
0393e6a274
...
427103f7a6
|
@ -566,7 +566,7 @@ static int server_send_nak(sd_dhcp_server *server, DHCPRequest *req) {
|
|||
}
|
||||
|
||||
static int server_send_forcerenew(sd_dhcp_server *server, be32_t address,
|
||||
be32_t gateway, const uint8_t chaddr[]) {
|
||||
be32_t gateway, uint8_t chaddr[]) {
|
||||
_cleanup_free_ DHCPPacket *packet = NULL;
|
||||
size_t optoffset = 0;
|
||||
int r;
|
||||
|
|
|
@ -218,7 +218,7 @@ static int clean_sysvipc_msg(uid_t delete_uid, gid_t delete_gid, bool rm) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int clean_posix_shm_internal(const char *dirname, DIR *dir, uid_t uid, gid_t gid, bool rm) {
|
||||
static int clean_posix_shm_internal(DIR *dir, uid_t uid, gid_t gid, bool rm) {
|
||||
struct dirent *de;
|
||||
int ret = 0, r;
|
||||
|
||||
|
@ -234,8 +234,7 @@ static int clean_posix_shm_internal(const char *dirname, DIR *dir, uid_t uid, gi
|
|||
if (errno == ENOENT)
|
||||
continue;
|
||||
|
||||
ret = log_warning_errno(errno, "Failed to stat() POSIX shared memory segment %s/%s: %m",
|
||||
dirname, de->d_name);
|
||||
ret = log_warning_errno(errno, "Failed to stat() POSIX shared memory segment %s: %m", de->d_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -245,10 +244,9 @@ static int clean_posix_shm_internal(const char *dirname, DIR *dir, uid_t uid, gi
|
|||
kid = xopendirat(dirfd(dir), de->d_name, O_NOFOLLOW|O_NOATIME);
|
||||
if (!kid) {
|
||||
if (errno != ENOENT)
|
||||
ret = log_warning_errno(errno, "Failed to enter shared memory directory %s/%s: %m",
|
||||
dirname, de->d_name);
|
||||
ret = log_warning_errno(errno, "Failed to enter shared memory directory %s: %m", de->d_name);
|
||||
} else {
|
||||
r = clean_posix_shm_internal(de->d_name, kid, uid, gid, rm);
|
||||
r = clean_posix_shm_internal(kid, uid, gid, rm);
|
||||
if (r < 0)
|
||||
ret = r;
|
||||
}
|
||||
|
@ -264,8 +262,7 @@ static int clean_posix_shm_internal(const char *dirname, DIR *dir, uid_t uid, gi
|
|||
if (errno == ENOENT)
|
||||
continue;
|
||||
|
||||
ret = log_warning_errno(errno, "Failed to remove POSIX shared memory directory %s/%s: %m",
|
||||
dirname, de->d_name);
|
||||
ret = log_warning_errno(errno, "Failed to remove POSIX shared memory directory %s: %m", de->d_name);
|
||||
} else {
|
||||
log_debug("Removed POSIX shared memory directory %s", de->d_name);
|
||||
if (ret == 0)
|
||||
|
@ -310,7 +307,7 @@ static int clean_posix_shm(uid_t uid, gid_t gid, bool rm) {
|
|||
return log_warning_errno(errno, "Failed to open /dev/shm: %m");
|
||||
}
|
||||
|
||||
return clean_posix_shm_internal("/dev/shm", dir, uid, gid, rm);
|
||||
return clean_posix_shm_internal(dir, uid, gid, rm);
|
||||
}
|
||||
|
||||
static int clean_posix_mq(uid_t uid, gid_t gid, bool rm) {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
|
||||
#include "clean-ipc.h"
|
||||
#include "errno-util.h"
|
||||
#include "main-func.h"
|
||||
#include "tests.h"
|
||||
#include "user-util.h"
|
||||
#include "tests.h"
|
||||
#include "util.h"
|
||||
|
||||
static int run(int argc, char *argv[]) {
|
||||
int main(int argc, char *argv[]) {
|
||||
uid_t uid;
|
||||
int r;
|
||||
const char* name = argv[1] ?: NOBODY_USER_NAME;
|
||||
|
@ -16,14 +15,11 @@ static int run(int argc, char *argv[]) {
|
|||
r = get_user_creds(&name, &uid, NULL, NULL, NULL, 0);
|
||||
if (r == -ESRCH)
|
||||
return log_tests_skipped("Failed to resolve user");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to resolve \"%s\": %m", name);
|
||||
|
||||
r = clean_ipc_by_uid(uid);
|
||||
if (ERRNO_IS_PRIVILEGE(r))
|
||||
return log_tests_skipped("No privileges");
|
||||
|
||||
return r;
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to resolve \"%s\": %m", name);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);
|
||||
r = clean_ipc_by_uid(uid);
|
||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue