bin/144644: [patch] Fix *alloc cornercases with config(1)
Ruslan Ermilov
ru at FreeBSD.org
Tue Mar 30 10:40:08 UTC 2010
The following reply was made to PR bin/144644; it has been noted by GNATS.
From: Ruslan Ermilov <ru at FreeBSD.org>
To: Garrett Cooper <gcooper at FreeBSD.org>
Cc: bug-followup at FreeBSD.org
Subject: Re: bin/144644: [patch] Fix *alloc cornercases with config(1)
Date: Tue, 30 Mar 2010 14:34:26 +0400
On Sun, Mar 21, 2010 at 04:58:18AM -0700, Garrett Cooper wrote:
> On Sat, Mar 13, 2010 at 12:36 AM, Garrett Cooper <gcooper at freebsd.org> wrote:
> > On Fri, Mar 12, 2010 at 11:28 PM, Garrett Cooper <yanegomi at gmail.com> wrote:
> >> The attached patch addresses the non-style(9) conformity with my
> >> previous patch as pointed out by several folks on current at .
> >
> > Sorry -- missed a spot...
>
> The following patch incorporates a logical change from errx(3) to
> err(3) made by ru@ in an informal review. I also picked up a few other
> logical messages that were originally errx(EXIT_ERR, ...) and
> converted them to err(EXIT_ERR, ...) in a similar fashion.
Part of the changes are invalid (shouldn't have been converted from
errx() to err()).
: Index: main.c
: ===================================================================
: --- main.c (revision 205872)
: +++ main.c (working copy)
: @@ -120,7 +120,7 @@
: if (*destdir == '\0')
: strlcpy(destdir, optarg, sizeof(destdir));
: else
: - errx(2, "directory already set");
: + err(EXIT_FAILURE, "directory already set");
: break;
: case 'g':
: debugging++;
: @@ -175,7 +175,7 @@
: if (mkdir(p, 0777))
: err(2, "%s", p);
: } else if (!S_ISDIR(buf.st_mode))
: - errx(2, "%s isn't a directory", p);
: + err(EXIT_FAILURE, "%s isn't a directory", p);
:
: SLIST_INIT(&cputype);
: SLIST_INIT(&mkopt);
: @@ -519,7 +519,7 @@
: */
: p = strstr(kernconfstr, KERNCONFTAG);
: if (p == NULL)
: - errx(EXIT_FAILURE, "Something went terribly wrong!");
: + err(EXIT_FAILURE, "Something went terribly wrong!");
: *p = '\0';
: fprintf(fo, "%s", kernconfstr);
: fprintf(fo, "%s", sbuf_data(sb));
: @@ -671,19 +673,19 @@
: [...]
: if (S_ISDIR(st.st_mode))
: - errx(EXIT_FAILURE, "'%s' is a directory", file);
: + err(EXIT_FAILURE, "'%s' is a directory", file);
: fp = fdopen(r, "r");
: [...]
: pp = popen(cmd, "r");
: if (pp == NULL)
: - errx(EXIT_FAILURE, "popen() failed");
: + err(EXIT_FAILURE, "popen() failed");
This is questionable; see the popen(3) manpage for details,
section ERRORS.
: Index: lang.l
: ===================================================================
: --- lang.l (revision 205872)
: +++ lang.l (working copy)
: @@ -31,6 +31,7 @@
: * $FreeBSD$
: */
:
: +#include <err.h>
Misplaced include.
: #include <assert.h>
: #include <ctype.h>
: #include <string.h>
Cheers,
--
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
More information about the freebsd-bugs
mailing list