Skip to content

Commit 1e5f8f8

Browse files
committed
sapi/cli: setting process name little optimisation.
1 parent 8291e81 commit 1e5f8f8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sapi/cli/ps_title.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <process.h>
3535
#include "win32/codepage.h"
3636
#else
37+
#include <php.h>
3738
#include <php_config.h>
3839
extern char** environ;
3940
#endif
@@ -342,9 +343,7 @@ int set_ps_title(const char* title)
342343
if (rc != PS_TITLE_SUCCESS)
343344
return rc;
344345

345-
strncpy(ps_buffer, title, ps_buffer_size);
346-
ps_buffer[ps_buffer_size - 1] = '\0';
347-
ps_buffer_cur_len = strlen(ps_buffer);
346+
ps_buffer_cur_len = strlcpy(ps_buffer, title, ps_buffer_size);
348347

349348
#ifdef PS_USE_SETPROCTITLE
350349
setproctitle("%s", ps_buffer);

0 commit comments

Comments
 (0)