forked from pool/systemd
bbba62be60
- Add or port upstream bugfix patches: 0001-Fix-systemd-stdio-bridge-symlink.patch 0002-execute-free-directory-path-if-we-fail-to-remove-it-.patch 0003-Do-not-print-invalid-UTF-8-in-error-messages.patch 0004-man-document-missing-options-of-systemd-run.patch 0005-systemd-run-add-some-extra-safety-checks.patch 0006-journal-assume-that-next-entry-is-after-previous-ent.patch 0007-journal-forget-file-after-encountering-an-error.patch 0008-core-correctly-unregister-PIDs-from-PID-hashtables.patch 0009-logind-fix-reference-to-systemd-user-sessions.servic.patch 0010-man-update-link-to-LSB.patch 0011-man-systemd-bootchart-fix-spacing-in-command.patch 0012-man-add-missing-comma.patch 0013-units-Do-not-unescape-instance-name-in-systemd-backl.patch - Add linker scripts as place holder of the old systemd shared libraries now all included in libsystemd.so (bnc#867128) - Make patch 1006-udev-always-rename-network.patch work again and add it again. - address missing owner functionality in systemd-tmpfiles (fate#314974) 1022-systemd-tmpfiles-ownerkeep.patch - Generate the bash completion files on the fly for the case of not having the package bash-completion around - Add or port upstream bugfix patches: 0001-nspawn-fix-detection-of-missing-proc-self-loginuid.patch 0002-cdrom_id-use-the-old-MMC-fallback.patch 0003-journalctl-refuse-extra-arguments-with-verify-and-si.patch OBS-URL: https://build.opensuse.org/request/show/225408 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=177
53 lines
2.1 KiB
Diff
53 lines
2.1 KiB
Diff
From a1937e679f76758635d295287398abe526de2522 Mon Sep 17 00:00:00 2001
|
|
From: David Herrmann <dh.herrmann@gmail.com>
|
|
Date: Tue, 25 Feb 2014 12:20:25 +0100
|
|
Subject: [PATCH] login: fix pos-array allocation
|
|
|
|
GREEDY_REALLOC takes a pointer to the real size, not the array-width as
|
|
argument. Therefore, our array is currently way to small to keep the seat
|
|
positions.
|
|
|
|
Introduce GREEDY_REALLOC0_T() as typed version of GREEDY_REALLOC and store
|
|
the array-width instead of array-size.
|
|
---
|
|
src/login/logind-seat.c | 2 +-
|
|
src/shared/util.h | 9 +++++++++
|
|
2 files changed, 10 insertions(+), 1 deletion(-)
|
|
|
|
diff --git src/login/logind-seat.c src/login/logind-seat.c
|
|
index 631be5f..36ec7ed 100644
|
|
--- src/login/logind-seat.c
|
|
+++ src/login/logind-seat.c
|
|
@@ -475,7 +475,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
|
|
if (seat_has_vts(s))
|
|
pos = session->vtnr;
|
|
|
|
- if (!GREEDY_REALLOC0(s->positions, s->position_count, pos + 1))
|
|
+ if (!GREEDY_REALLOC0_T(s->positions, s->position_count, pos + 1))
|
|
return;
|
|
|
|
seat_evict_position(s, session);
|
|
diff --git src/shared/util.h src/shared/util.h
|
|
index 9913fce..78b1444 100644
|
|
--- src/shared/util.h
|
|
+++ src/shared/util.h
|
|
@@ -723,6 +723,15 @@ void* greedy_realloc0(void **p, size_t *allocated, size_t need);
|
|
#define GREEDY_REALLOC0(array, allocated, need) \
|
|
greedy_realloc0((void**) &(array), &(allocated), sizeof((array)[0]) * (need))
|
|
|
|
+#define GREEDY_REALLOC0_T(array, count, need) \
|
|
+ ({ \
|
|
+ size_t _size = (count) * sizeof((array)[0]); \
|
|
+ void *_ptr = GREEDY_REALLOC0((array), _size, (need)); \
|
|
+ if (_ptr) \
|
|
+ (count) = _size / sizeof((array)[0]); \
|
|
+ _ptr; \
|
|
+ })
|
|
+
|
|
static inline void _reset_errno_(int *saved_errno) {
|
|
errno = *saved_errno;
|
|
}
|
|
--
|
|
1.7.9.2
|
|
|