summaryrefslogtreecommitdiff
path: root/usr.bin/sup
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-15 07:21:10 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-15 07:21:10 +0000
commit04cc746620956f96339007ae227214f44c1bf2e9 (patch)
tree1ea6279d7412928c567bff0025824fccf3c2680e /usr.bin/sup
parentdb8059726ab4980644c23dd406242bfa6ff4cef6 (diff)
a bit of string cleaning
Diffstat (limited to 'usr.bin/sup')
-rw-r--r--usr.bin/sup/src/path.c14
-rw-r--r--usr.bin/sup/src/supcmeat.c6
-rw-r--r--usr.bin/sup/src/supcmisc.c6
-rw-r--r--usr.bin/sup/src/supextern.h4
4 files changed, 16 insertions, 14 deletions
diff --git a/usr.bin/sup/src/path.c b/usr.bin/sup/src/path.c
index d55fbd4d796..c0904a6892d 100644
--- a/usr.bin/sup/src/path.c
+++ b/usr.bin/sup/src/path.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: path.c,v 1.5 2001/05/04 22:16:15 millert Exp $ */
+/* $OpenBSD: path.c,v 1.6 2003/04/15 07:21:09 deraadt Exp $ */
/*
* Copyright (c) 1991 Carnegie Mellon University
@@ -64,8 +64,10 @@
#include "supextern.h"
void
-path(original, direc, file, filen)
- char *original, *direc, *file;
+path(original, direc, direclen, file, filen)
+ char *original, *direc;
+ int direclen;
+ char *file;
int filen;
{
char *y;
@@ -99,12 +101,12 @@ path(original, direc, file, filen)
if (*y)
strlcpy(file, y, filen);
else
- strcpy(file, ".");
+ strlcpy(file, ".", filen);
/* find directory part */
if (direc == y)
- strcpy(direc, ".");
+ strlcpy(direc, ".", direclen);
else if (*direc == 0)
- strcpy(direc, "/");
+ strlcpy(direc, "/", direclen);
/* else direc already has proper value */
}
diff --git a/usr.bin/sup/src/supcmeat.c b/usr.bin/sup/src/supcmeat.c
index 8b8408acdb0..b539581c6bc 100644
--- a/usr.bin/sup/src/supcmeat.c
+++ b/usr.bin/sup/src/supcmeat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: supcmeat.c,v 1.17 2002/06/12 06:07:16 mpech Exp $ */
+/* $OpenBSD: supcmeat.c,v 1.18 2003/04/15 07:21:09 deraadt Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
@@ -1027,7 +1027,7 @@ recvreg(t, new, statp) /* receive file from network */
t->Tname);
return (TRUE); /* mark upgrade as nogood */
}
- path(t->Tname, dirpart, filepart, sizeof filepart);
+ path(t->Tname, dirpart, sizeof dirpart, filepart, sizeof filepart);
(void) snprintf(filename, sizeof filename, FILEBACKUP,
dirpart, filepart);
fout = fopen(filename, "w");
@@ -1174,7 +1174,7 @@ copyfile(to, from)
/* Now try hard to find a temp file name. Try VERY hard. */
for (;;) {
/* try destination directory */
- path(to, dpart, fpart, sizeof fpart);
+ path(to, dpart, sizeof dpart, fpart, sizeof fpart);
(void) snprintf(tname, sizeof tname, "%s/#%ld.sup",
dpart, (long)thispid);
tof = open(tname, (O_WRONLY|O_CREAT|O_TRUNC), 0600);
diff --git a/usr.bin/sup/src/supcmisc.c b/usr.bin/sup/src/supcmisc.c
index 50e92b8ac44..36e427e69d5 100644
--- a/usr.bin/sup/src/supcmisc.c
+++ b/usr.bin/sup/src/supcmisc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: supcmisc.c,v 1.14 2002/04/30 01:59:47 deraadt Exp $ */
+/* $OpenBSD: supcmisc.c,v 1.15 2003/04/15 07:21:09 deraadt Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
@@ -109,7 +109,7 @@ establishdir(fname)
{
char dpart[STRINGLENGTH], fpart[STRINGLENGTH];
- path(fname, dpart, fpart, sizeof fpart);
+ path(fname, dpart, sizeof dpart, fpart, sizeof fpart);
return (estabd(fname, dpart));
}
@@ -141,7 +141,7 @@ estabd(fname, dname)
if (stat(dname, &sbuf) >= 0)
return (FALSE); /* exists */
- path(dname, dpart, fpart, sizeof fpart);
+ path(dname, dpart, sizeof dpart, fpart, sizeof fpart);
if (strcmp(fpart,".") == 0) { /* dname is / or . */
notify("SUP: Can't create directory %s for %s\n", dname, fname);
return (TRUE);
diff --git a/usr.bin/sup/src/supextern.h b/usr.bin/sup/src/supextern.h
index d371c9417a5..16568044af4 100644
--- a/usr.bin/sup/src/supextern.h
+++ b/usr.bin/sup/src/supextern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: supextern.h,v 1.7 2002/02/17 19:42:33 millert Exp $ */
+/* $OpenBSD: supextern.h,v 1.8 2003/04/15 07:21:09 deraadt Exp $ */
/* atoo.c */
unsigned int atoo(char *);
@@ -40,7 +40,7 @@ void encode(char *, char *, int);
char *nxtarg(char **, char *);
/* path.c */
-void path(char *, char *, char *, int);
+void path(char *, char *, int, char *, int);
/* quit.c */
void quit(int, char *, ...);