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:
commit
99f8a6d7f5
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user