1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-07 17:17:44 +03:00

Merge pull request #21581 from keszybz/really-random-fixlets

Really random fixlets
This commit is contained in:
Yu Watanabe 2021-12-01 12:54:00 +09:00 committed by GitHub
commit 99f8a6d7f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 7 deletions

View File

@ -13,7 +13,7 @@ def read_os_release():
filename = '/usr/lib/os-release'
f = open(filename)
for line_number, line in enumerate(f):
for line_number, line in enumerate(f, start=1):
line = line.rstrip()
if not line or line.startswith('#'):
continue
@ -23,7 +23,7 @@ def read_os_release():
val = ast.literal_eval(val)
yield name, val
else:
print(f'{filename}:{line_number + 1}: bad line {line!r}',
print(f'{filename}:{line_number}: bad line {line!r}',
file=sys.stderr)
os_release = dict(read_os_release())

View File

@ -108,10 +108,7 @@ static int process_managed_oom_message(Manager *m, uid_t uid, JsonVariant *param
if (streq(message.property, "ManagedOOMMemoryPressure") && message.limit > 0) {
int permyriad = UINT32_SCALE_TO_PERMYRIAD(message.limit);
r = store_loadavg_fixed_point(
(unsigned long) permyriad / 100,
(unsigned long) permyriad % 100,
&limit);
r = store_loadavg_fixed_point(permyriad / 100LU, permyriad % 100LU, &limit);
if (r < 0)
continue;
}

View File

@ -129,7 +129,9 @@ static int rm_rf_children_inner(
assert(fd >= 0);
assert(fname);
if (is_dir < 0 || (is_dir > 0 && (root_dev || (flags & REMOVE_SUBVOLUME)))) {
if (is_dir < 0 ||
root_dev ||
(is_dir > 0 && (root_dev || (flags & REMOVE_SUBVOLUME)))) {
r = fstatat_harder(fd, fname, &st, AT_SYMLINK_NOFOLLOW, flags);
if (r < 0)

View File

@ -93,5 +93,13 @@ int main(void) {
printf("timeval: %zu\n", sizeof(struct timeval));
printf("timespec: %zu\n", sizeof(struct timespec));
void *x = malloc(100);
printf("local variable: %p\n", &function_pointer);
printf("glibc function: %p\n", memcpy);
printf("heap allocation: %p\n", x);
free(x);
return 0;
}