Content-Length: 264415 | pFad | http://github.com/postgrespro/postgres/commit/416e82ce9f0c8c4ec6d377368d670b8ca74097a6

0E Simplify new pg_ctl newline termination code. · postgrespro/postgres@416e82c · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/416e82ce9f0c8c4ec6d377368d670b8ca74097a6

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy