Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fsck use MAXPATHLEN instead of 32 as the size of the ra...



details:   https://anonhg.NetBSD.org/src/rev/91b3ecc96bd2
branches:  trunk
changeset: 517247:91b3ecc96bd2
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Nov 09 07:50:19 2001 +0000

description:
use MAXPATHLEN instead of 32 as the size of the rawbuf

diffstat:

 sbin/fsck/fsutil.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (56 lines):

diff -r c6408618bcb8 -r 91b3ecc96bd2 sbin/fsck/fsutil.c
--- a/sbin/fsck/fsutil.c        Fri Nov 09 07:43:16 2001 +0000
+++ b/sbin/fsck/fsutil.c        Fri Nov 09 07:50:19 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fsutil.c,v 1.10 2001/06/18 02:31:09 lukem Exp $        */
+/*     $NetBSD: fsutil.c,v 1.11 2001/11/09 07:50:19 lukem Exp $        */
 
 /*
  * Copyright (c) 1990, 1993
@@ -35,9 +35,11 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: fsutil.c,v 1.10 2001/06/18 02:31:09 lukem Exp $");
+__RCSID("$NetBSD: fsutil.c,v 1.11 2001/11/09 07:50:19 lukem Exp $");
 #endif /* not lint */
 
+#include <sys/param.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -155,7 +157,7 @@
 const char *
 unrawname(const char *name)
 {
-       static char unrawbuf[32];
+       static char unrawbuf[MAXPATHLEN];
        const char *dp;
        struct stat stb;
 
@@ -167,19 +169,21 @@
                return (name);
        if (dp[1] != 'r')
                return (name);
-       (void)snprintf(unrawbuf, 32, "%.*s/%s", (int)(dp - name), name, dp + 2);
+       (void)snprintf(unrawbuf, sizeof(unrawbuf), "%.*s/%s",
+           (int)(dp - name), name, dp + 2);
        return (unrawbuf);
 }
 
 const char *
 rawname(const char *name)
 {
-       static char rawbuf[32];
+       static char rawbuf[MAXPATHLEN];
        const char *dp;
 
        if ((dp = strrchr(name, '/')) == 0)
                return (0);
-       (void)snprintf(rawbuf, 32, "%.*s/r%s", (int)(dp - name), name, dp + 1);
+       (void)snprintf(rawbuf, sizeof(rawbuf), "%.*s/r%s",
+           (int)(dp - name), name, dp + 1);
        return (rawbuf);
 }
 



Home | Main Index | Thread Index | Old Index