Date: Tue, 5 Jan 1999 21:10:01 -0800 (PST) From: Joseph Koshy <jkoshy@FreeBSD.ORG> To: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/3246: mtree -c should escape whitespace and special characters Message-ID: <199901060510.VAA23773@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/3246; it has been noted by GNATS.
From: Joseph Koshy <jkoshy>
To: Slaven Rezic <eserte@cs.tu-berlin.de>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/3246: mtree -c should escape whitespace and special characters
Date: Tue, 5 Jan 1999 21:08:11 -0800 (PST)
I was looking at your PR with the intent of committing the patches.
I have a few points:
1. new file `escape.c'
- needs a copyright (you could copy the copyright from the other
files). Alternatively you could fold the code into an
existing file like `misc.c'.
- needs to follow the same source style as the rest of mtree
(see style(9) for hints)
The same comments apply to "escape.h" too.
2. Rather than have to call 'escaped_len()' and 'unescaped_len()'
can then allocate the required space, how about making the
`escape()' and `unescape()' functions do the space allocation
transparently? This allows the caller to just call `escape'
or `unescape()' and free the returned pointer when done.
3. In 'spec.c', you are calloc()ing as follows:
--- 140,152 ----
noparent: errx(1, "line %d: no parent node", lineno);
}
! if ((centry = calloc(1, sizeof(NODE) + unescaped_len(p))) == NULL)
errx(1, "calloc");
*centry = ginfo;
This doesn't seem to leave space for the last '0'? The original
code also has this buglet.
If you could correct the above and submit the new patches as a
followup to this PR, it would be great.
Thanks,
Koshy
<jkoshy@freebsd.org>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901060510.VAA23773>
