From 086c189456655846707d9a260a3919f4404ecd9e Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 8 Feb 2007 11:10:27 +0000 Subject: Normalize fgets() calls to use sizeof() for calculating the buffer size where possible, and fix some sites that apparently thought that fgets() will overwrite the buffer by one byte. Also add some strlcpy() to eliminate some weird memory handling. --- src/backend/access/transam/xlog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/backend/access/transam/xlog.c') diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index b1a5a57b2f4..fa6731a3869 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.262 2007/02/07 16:44:47 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.263 2007/02/08 11:10:27 petere Exp $ * *------------------------------------------------------------------------- */ @@ -3374,7 +3374,7 @@ readTimeLineHistory(TimeLineID targetTLI) /* * Parse the file... */ - while (fgets(fline, MAXPGPATH, fd) != NULL) + while (fgets(fline, sizeof(fline), fd) != NULL) { /* skip leading whitespace and check for # comment */ char *ptr; @@ -4248,7 +4248,7 @@ readRecoveryCommandFile(void) /* * Parse the file... */ - while (fgets(cmdline, MAXPGPATH, fd) != NULL) + while (fgets(cmdline, sizeof(cmdline), fd) != NULL) { /* skip leading whitespace and check for # comment */ char *ptr; -- cgit v1.2.3