[devel] [PATCH v2 2/6] Link with libsetproctitle by Dmitry V. Levin
Arseny Maslennikov
arseny на altlinux.org
Чт Окт 22 14:43:39 MSK 2020
This being a shared library is an implementation detail: to overcome the
lack of such an interface on Linux, we need to run some preparation code
before main() and pass argv/envp memory buffers to it. A function
declared with __attribute__((constructor)) gets called with no
arguments, we can't pass the argv/envp buffers to it, so we put an
implementation of setproctitle(3) in a shared object and hijack its
_init().
Signed-off-by: Arseny Maslennikov <arseny на altlinux.org>
---
hasher-priv/Makefile | 3 ++-
hasher-priv/hasher-priv.spec | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/hasher-priv/Makefile b/hasher-priv/Makefile
index ce55274..283249b 100644
--- a/hasher-priv/Makefile
+++ b/hasher-priv/Makefile
@@ -39,6 +39,7 @@ CPPFLAGS = -std=gnu99 -D_GNU_SOURCE $(CHDIRUID_FLAGS) \
CFLAGS = -pipe -O2
override CFLAGS += $(WARNINGS)
LDLIBS =
+server_LDLIBS = -lsetproctitle
SRC = hasher-priv.c cmdline.c fds.c sockets.c logging.c communication.c xmalloc.c pass.c
OBJ = $(SRC:.c=.o)
@@ -62,7 +63,7 @@ $(PROJECT): $(OBJ)
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
hasher-privd: $(server_OBJ)
- $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) $(server_LDLIBS) -o $@
install: all
$(MKDIR_P) -m710 $(DESTDIR)$(configdir)/user.d
diff --git a/hasher-priv/hasher-priv.spec b/hasher-priv/hasher-priv.spec
index 2da9ee4..fac25cd 100644
--- a/hasher-priv/hasher-priv.spec
+++ b/hasher-priv/hasher-priv.spec
@@ -20,6 +20,7 @@ Obsoletes: pkg-build-priv
Conflicts: hasher < 1.4.0
BuildPreReq: help2man, sisyphus_check >= 0:0.7.11
+BuildRequires: setproctitle-devel
%description
This package provides helpers for executing privileged operations
--
2.25.4
Подробная информация о списке рассылки Devel