Welcome! Log In Create A New Profile

Advanced

[PATCH] fix crash with ngx_setproctitle

Markus Linnala
August 17, 2014 04:26PM
Test ngx_init_setproctitle return value to prevent crash at ngx_setproctitle.

Added modifications not to break environments without setproctitle.
Fix from Maxim Dounin.

diff -r 79553cb77747 -r 69fdb8f8270e src/os/unix/ngx_posix_init.c
--- a/src/os/unix/ngx_posix_init.c Fri Aug 15 14:09:29 2014 +0400
+++ b/src/os/unix/ngx_posix_init.c Sun Aug 17 21:01:53 2014 +0300
@@ -40,7 +40,9 @@
}
#endif

- ngx_init_setproctitle(log);
+ if (ngx_init_setproctitle(log) != NGX_OK) {
+ return NGX_ERROR;
+ }

ngx_pagesize = getpagesize();
ngx_cacheline_size = NGX_CPU_CACHE_LINE;
diff -r 79553cb77747 -r 69fdb8f8270e src/os/unix/ngx_setproctitle.h
--- a/src/os/unix/ngx_setproctitle.h Fri Aug 15 14:09:29 2014 +0400
+++ b/src/os/unix/ngx_setproctitle.h Sun Aug 17 21:01:53 2014 +0300
@@ -13,7 +13,7 @@

/* FreeBSD, NetBSD, OpenBSD */

-#define ngx_init_setproctitle(log)
+#define ngx_init_setproctitle(log) NGX_OK
#define ngx_setproctitle(title) setproctitle("%s", title)


@@ -39,7 +39,7 @@

#else

-#define ngx_init_setproctitle(log)
+#define ngx_init_setproctitle(log) NGX_OK
#define ngx_setproctitle(title)

#endif /* OSes */

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] fix crash with ngx_setproctitle

Markus Linnala 644 August 17, 2014 04:26PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 154
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready