Skip to content

Commit 416e82c

Browse files
committed
Simplify new pg_ctl newline termination code.
1 parent aaa6e1d commit 416e82c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/bin/pg_ctl/pg_ctl.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,8 +1934,10 @@ adjust_data_dir(void)
19341934
pclose(fd);
19351935
free(my_exec_path);
19361936

1937-
if (strlen(filename) > 0 && filename[strlen(filename) - 1] == '\n')
1938-
filename[strlen(filename) - 1] = '\0';
1937+
/* Remove trailing newline */
1938+
if (strchr(filename, '\n') != NULL)
1939+
*strchr(filename, '\n') = '\0';
1940+
19391941
free(pg_data);
19401942
pg_data = xstrdup(filename);
19411943
canonicalize_path(pg_data);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy