summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-09-06 21:16:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-09-06 21:16:17 +0000
commit3beaa0ee6bb6c74d4fac2a16c45d099c9626c10a (patch)
treea981509f3b2b171db6ab7795da846e8c6a5d37e6
parent4c7903c3ae8a4d6ae9fe61219f2cfba1693eab74 (diff)
support long names; henning ok
-rw-r--r--sbin/fsck/fsutil.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sbin/fsck/fsutil.c b/sbin/fsck/fsutil.c
index c666d7b6e77..03bc763c489 100644
--- a/sbin/fsck/fsutil.c
+++ b/sbin/fsck/fsutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsutil.c,v 1.7 2002/07/03 22:32:32 deraadt Exp $ */
+/* $OpenBSD: fsutil.c,v 1.8 2002/09/06 21:16:16 deraadt Exp $ */
/* $NetBSD: fsutil.c,v 1.2 1996/10/03 20:06:31 christos Exp $ */
/*
@@ -37,6 +37,7 @@
static char rcsid[] = "$NetBSD: fsutil.c,v 1.2 1996/10/03 20:06:31 christos Exp $";
#endif /* not lint */
+#include <sys/param.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -151,7 +152,7 @@ unrawname(char *name)
char *dp;
struct stat stb;
- if ((dp = strrchr(name, '/')) == 0)
+ if ((dp = strrchr(name, '/')) == NULL)
return (name);
if (stat(name, &stb) < 0)
return (name);
@@ -166,16 +167,16 @@ unrawname(char *name)
char *
rawname(char *name)
{
- static char rawbuf[32];
+ static char rawbuf[MAXPATHLEN];
char *dp;
- if ((dp = strrchr(name, '/')) == 0)
+ if ((dp = strrchr(name, '/')) == NULL)
return (0);
*dp = 0;
- (void)strcpy(rawbuf, name);
+ (void)strlcpy(rawbuf, name, sizeof rawbuf);
*dp = '/';
- (void)strcat(rawbuf, "/r");
- (void)strcat(rawbuf, &dp[1]);
+ (void)strlcat(rawbuf, "/r", sizeof rawbuf);
+ (void)strlcat(rawbuf, &dp[1], sizeof rawbuf);
return (rawbuf);
}