diff options
| author | Roy Marples <roy@marples.name> | 2019-10-15 13:40:13 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2019-10-15 13:40:13 +0100 |
| commit | a644b9e11971993d16beed3940cebd28fc243048 (patch) | |
| tree | d4278c85ede071690e38330e2c72bf7da23f89db /compat | |
| parent | c085a2836f8439bc3e9d01a85d399afb8ad1dc12 (diff) | |
| download | dhcpcd-a644b9e11971993d16beed3940cebd28fc243048.tar.xz | |
Revert "compat: Fix setproctitle on Solaris"
This reverts commit c085a2836f8439bc3e9d01a85d399afb8ad1dc12.
Diffstat (limited to 'compat')
| -rw-r--r-- | compat/setproctitle.c | 18 | ||||
| -rw-r--r-- | compat/setproctitle.h | 4 |
2 files changed, 6 insertions, 16 deletions
diff --git a/compat/setproctitle.c b/compat/setproctitle.c index c1d4d705..9350e5ee 100644 --- a/compat/setproctitle.c +++ b/compat/setproctitle.c @@ -30,28 +30,24 @@ #include <string.h> #include "config.h" -#include "dhcpcd.h" #ifdef __sun #define SETPROCTITLE_PAD ' ' -extern const char **environ; #else #define SETPROCTITLE_PAD '\0' #endif -static struct dhcpcd_ctx *setproctitle_ctx; static int setproctitle_argc; -static const char *setproctitle_argv_last; +static char *setproctitle_argv_last; static char **setproctitle_argv; static char *setproctitle_buf; int -setproctitle_init(struct dhcpcd_ctx *ctx, int argc, char **argv) +setproctitle_init(int argc, char **argv) { size_t i, len; char *p; - setproctitle_ctx = ctx; len = 0; for (i = 0; environ[i] != NULL; i++) len += strlen(environ[i]) + 1; @@ -123,20 +119,16 @@ setproctitle(const char *fmt, ...) int i; len = 0; - for (i = 0; i < setproctitle_ctx->argc; i++) { - len += strlen(setproctitle_ctx->argv[i]) + 1; - } + for (i = 0; i < setproctitle_argc; i++) + len += strlen(setproctitle_argv[i]) + 1; if (len > (size_t)(p - setproctitle_argv[0])) { p += strlcpy(p, " (", LAST_SIZE); for (i = 0; i < setproctitle_argc; i++) { - p += strlcpy(p, setproctitle_ctx->argv[i], LAST_SIZE); + p += strlcpy(p, setproctitle_argv[i], LAST_SIZE); p += strlcpy(p, " ", LAST_SIZE); } } - - if (*(p - 1) == ' ') - *(p - 1) = ')'; #endif if (setproctitle_argv_last - p > 0) diff --git a/compat/setproctitle.h b/compat/setproctitle.h index ede12650..18249947 100644 --- a/compat/setproctitle.h +++ b/compat/setproctitle.h @@ -28,8 +28,6 @@ #ifndef SETPROCTITLE_H #define SETPROCTITLE_H -#include "dhcpcd.h" - #ifndef __printflike #if __GNUC__ > 2 || defined(__INTEL_COMPILER) #define __printflike(a, b) __attribute__((format(printf, a, b))) @@ -38,7 +36,7 @@ #endif #endif /* !__printflike */ -int setproctitle_init(struct dhcpcd_ctx *ctx, int, char **); +int setproctitle_init(int, char **); void setproctitle_free(void); __printflike(1, 2) void setproctitle(const char *, ...); #endif |
