Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/xlint Slight improvement to last fix: don't n...
details: https://anonhg.NetBSD.org/src/rev/5c795931fb09
branches: trunk
changeset: 476123:5c795931fb09
user: jwise <jwise%NetBSD.org@localhost>
date: Tue Sep 07 02:36:57 1999 +0000
description:
Slight improvement to last fix: don't need to reset the cpp tempfile for
files which don't need to be run through cpp. Also, use vfork() instead of
fork().
Both from Anders Hjalmarsson (Anders.Hjalmarsson%economics.gu.se@localhost)
diffstat:
usr.bin/xlint/xlint/xlint.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diffs (69 lines):
diff -r 4802ebc051a5 -r 5c795931fb09 usr.bin/xlint/xlint/xlint.c
--- a/usr.bin/xlint/xlint/xlint.c Tue Sep 07 00:49:41 1999 +0000
+++ b/usr.bin/xlint/xlint/xlint.c Tue Sep 07 02:36:57 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.14 1999/09/06 06:45:20 jwise Exp $ */
+/* $NetBSD: xlint.c,v 1.15 1999/09/07 02:36:57 jwise Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: xlint.c,v 1.14 1999/09/06 06:45:20 jwise Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.15 1999/09/07 02:36:57 jwise Exp $");
#endif
#include <sys/param.h>
@@ -541,15 +541,6 @@
int is_stdin;
int fd;
- if (lseek(cppoutfd, SEEK_SET, (off_t)0) != 0) {
- warn("lseek");
- terminate(-1);
- }
- if (ftruncate(cppoutfd, (off_t)0) != 0) {
- warn("ftruncate");
- terminate(-1);
- }
-
is_stdin = (strcmp(name, "-") == 0);
bn = basename(name, '/');
suff = basename(bn, '.');
@@ -610,6 +601,16 @@
applst(&args, lcflags);
appcstrg(&args, name);
+ /* we reuse the same tmp file for cpp output, so rewind and truncate */
+ if (lseek(cppoutfd, SEEK_SET, (off_t)0) != 0) {
+ warn("lseek");
+ terminate(-1);
+ }
+ if (ftruncate(cppoutfd, (off_t)0) != 0) {
+ warn("ftruncate");
+ terminate(-1);
+ }
+
runchild(path, args, cppout, cppoutfd);
free(path);
freelst(&args);
@@ -652,7 +653,7 @@
(void)fflush(stdout);
- switch (fork()) {
+ switch (vfork()) {
case -1:
warn("cannot fork");
terminate(-1);
@@ -670,7 +671,7 @@
}
(void)execv(path, args);
warn("cannot exec %s", path);
- exit(1);
+ _exit(1);
/* NOTREACHED */
}
Home |
Main Index |
Thread Index |
Old Index