[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree
zrouter-src-freebsd at zrouter.org
zrouter-src-freebsd at zrouter.org
Tue Dec 6 22:27:17 UTC 2011
details: http://zrouter.org/hg/FreeBSD/head//rev/3286aba03553
changeset: 241:3286aba03553
user: ray at terran.dlink.ua
date: Wed Dec 07 00:27:18 2011 +0200
description:
Revert makefs "fix".
diffstat:
head/usr.sbin/makefs/Makefile | 3 +--
head/usr.sbin/makefs/walk.c | 31 ++++++++-----------------------
2 files changed, 9 insertions(+), 25 deletions(-)
diffs (92 lines):
diff -r 3f45ccda8dda -r 3286aba03553 head/usr.sbin/makefs/Makefile
--- a/head/usr.sbin/makefs/Makefile Tue Dec 06 23:50:50 2011 +0200
+++ b/head/usr.sbin/makefs/Makefile Wed Dec 07 00:27:18 2011 +0200
@@ -2,8 +2,7 @@
PROG= makefs
-CFLAGS+=-I${.CURDIR} -g
-LDLAGS+=-g
+CFLAGS+=-I${.CURDIR}
SRCS= cd9660.c ffs.c \
getid.c \
diff -r 3f45ccda8dda -r 3286aba03553 head/usr.sbin/makefs/walk.c
--- a/head/usr.sbin/makefs/walk.c Tue Dec 06 23:50:50 2011 +0200
+++ b/head/usr.sbin/makefs/walk.c Wed Dec 07 00:27:18 2011 +0200
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/usr.sbin/makefs/walk.c 214921 2010-11-07 16:05:04Z cognet $");
#include <sys/param.h>
@@ -286,8 +286,7 @@
static void
apply_specdir(const char *dir, NODE *specnode, fsnode *dirnode, int speconly)
{
- /* char path[MAXPATHLEN + 1]; */
- char *path;
+ char path[MAXPATHLEN + 1];
NODE *curnode;
fsnode *curfsnode;
@@ -346,17 +345,9 @@
if (strcmp(curnode->name, curfsnode->name) == 0)
break;
}
- /* Check buffer size before fill it */
- if ((strlen(dir) + strlen(curnode->name) + 2) > MAXPATHLEN)
+ if (snprintf(path, sizeof(path), "%s/%s",
+ dir, curnode->name) >= sizeof(path))
errx(1, "Pathname too long.");
-
- path = malloc(MAXPATHLEN + 1);
-
- if (snprintf(path, sizeof(path), "%s/%s",
- dir, curnode->name) >= sizeof(path)) {
- free(path);
- errx(1, "Pathname too long.");
- }
if (curfsnode == NULL) { /* need new entry */
struct stat stbuf;
@@ -371,7 +362,7 @@
/* check that enough info is provided */
#define NODETEST(t, m) \
if (!(t)) \
- { free(path); errx(1, "`%s': %s not provided", path, m); }
+ errx(1, "`%s': %s not provided", path, m)
NODETEST(curnode->flags & F_TYPE, "type");
NODETEST(curnode->flags & F_MODE, "mode");
/* XXX: require F_TIME ? */
@@ -412,24 +403,18 @@
assert(curnode->slink != NULL);
/* for symlinks, copy the target */
if ((curfsnode->symlink =
- strdup(curnode->slink)) == NULL) {
- free(path);
+ strdup(curnode->slink)) == NULL)
err(1, "Memory allocation error");
- }
}
}
apply_specentry(dir, curnode, curfsnode);
if (curnode->type == F_DIR) {
- if (curfsnode->type != S_IFDIR) {
- printf("`%s' is not a directory", path);
- free(path);
- exit(1);
- }
+ if (curfsnode->type != S_IFDIR)
+ errx(1, "`%s' is not a directory", path);
assert (curfsnode->child != NULL);
apply_specdir(path, curnode, curfsnode->child, speconly);
}
}
- free(path);
}
static void
More information about the Zrouter-src-freebsd
mailing list