From: Ian Jackson Date: Mon, 15 Aug 2022 15:35:25 +0000 (+0100) Subject: prefork: add a magic number to prefork-interp X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=a8cbf7f35996c93079752bfa39dc43ea7e4f2956;hp=03c8d17d1aaa7fc9bf6816895fc48f84581caa4e;p=chiark-utils.git prefork: add a magic number to prefork-interp Signed-off-by: Ian Jackson --- diff --git a/cprogs/cgi-fcgi-interp.c b/cprogs/cgi-fcgi-interp.c index 3dbfef6..2de4661 100644 --- a/cprogs/cgi-fcgi-interp.c +++ b/cprogs/cgi-fcgi-interp.c @@ -150,6 +150,9 @@ void fusagemessage(FILE *f) { fprintf(f, "usage: #!/usr/bin/cgi-fcgi-interp []\n"); } +void ident_addinit(void) { +} + static int stderr_copy; static void make_stderr_copy(void) { diff --git a/cprogs/prefork-interp.c b/cprogs/prefork-interp.c index 018a791..6ee253f 100644 --- a/cprogs/prefork-interp.c +++ b/cprogs/prefork-interp.c @@ -100,6 +100,11 @@ const struct cmdinfo cmdinfos[]= { { 0 } }; +void ident_addinit(void) { + char ident_magic[1] = { 0 }; + sha256_update(&identsc, sizeof(ident_magic), ident_magic); +} + static void propagate_exit_status(int status, const char *what) { int r; diff --git a/cprogs/prefork.c b/cprogs/prefork.c index aaac059..909d065 100644 --- a/cprogs/prefork.c +++ b/cprogs/prefork.c @@ -206,6 +206,7 @@ void process_opts(const char *const **argv_io) { const char *smashedopt; sha256_init(&identsc); + ident_addinit(); if ((*argv_io)[0] && (smashedopt = (*argv_io)[1]) && diff --git a/cprogs/prefork.h b/cprogs/prefork.h index 617a455..4a3f996 100644 --- a/cprogs/prefork.h +++ b/cprogs/prefork.h @@ -83,5 +83,6 @@ void of_help(const struct cmdinfo *ci, const char *val); void of_iassign(const struct cmdinfo *ci, const char *val); void ident_addstring(const struct cmdinfo *ci, const char *string); void off_ident_addenv(const struct cmdinfo *ci, const char *name); +void ident_addinit(void); #endif /*PREFORK_H*/