diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2007-02-06 17:34:07 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2007-02-06 17:34:07 +0000 |
commit | af4732b160dadef1837e987c5166555a4ca520fe (patch) | |
tree | 3885497ff6ebf02e1b8a267e5c92a29282a63f01 /usr.bin | |
parent | 957251ed69d2e9ff66c97f0e67d0d734ecb6449a (diff) |
replace strl* overload and xstrdup() misuse by xsnprintf();
OK joris@.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/init.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/usr.bin/cvs/init.c b/usr.bin/cvs/init.c index 1f319f99fe9..30875e6b1f6 100644 --- a/usr.bin/cvs/init.c +++ b/usr.bin/cvs/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.29 2007/01/25 18:56:33 otto Exp $ */ +/* $OpenBSD: init.c,v 1.30 2007/02/06 17:34:06 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> @@ -140,7 +140,7 @@ init_mkfile(char *path, const char *const *content) BUF *b; size_t len; int fd, openflags, rcsflags; - char *rpath; + char rpath[MAXPATHLEN]; const char *const *p; RCSFILE *file; @@ -177,9 +177,7 @@ init_mkfile(char *path, const char *const *content) goto out; } - rpath = xstrdup(path); - if (strlcat(rpath, RCS_FILE_EXT, MAXPATHLEN) >= MAXPATHLEN) - fatal("init_mkfile: truncation"); + (void)xsnprintf(rpath, MAXPATHLEN, "%s%s", path, RCS_FILE_EXT); if ((file = rcs_open(rpath, fd, rcsflags, 0444)) == NULL) fatal("failed to create RCS file for `%s'", path); @@ -196,7 +194,6 @@ init_mkfile(char *path, const char *const *content) file->rf_flags &= ~RCS_SYNCED; rcs_close(file); - xfree(rpath); out: (void)close(fd); } |