*BSD News Article 12939


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!spool.mu.edu!wupost!uunet!not-for-mail
From: sef@Kithrup.COM (Sean Eric Fagan)
Newsgroups: comp.os.386bsd.bugs
Subject: Re: Bug in 386bsd 0.2 (patches up to 110)
Date: 17 Mar 1993 14:25:43 -0800
Organization: Kithrup Enterprises, Ltd.
Lines: 23
Sender: sef@ftp.UU.NET
Message-ID: <1o88h7INN9mp@ftp.UU.NET>
References: <1o30cgINN87l@jhunix.hcf.jhu.edu> <1o3111INNhiv@ftp.UU.NET> <1o31jaINNapm@jhunix.hcf.jhu.edu> <1o32kdINNide@ftp.uu.net>
NNTP-Posting-Host: ftp.uu.net

In article <1o32kdINNide@ftp.uu.net> sef@Kithrup.COM (Sean Eric Fagan) writes:
>And so it was.  I tested it, and found the problem.  In
>/usr/src/usr.bin/ld/ld.c, around line 3124, it does:
>
>	(void)unlink (output_filename);
>
>I think you can just delete that, or you can change it to do:
>
>  if (stat (output_filename, &statbuf) != -1) {
>    if (S_ISREG(statbuf.st_mode))
>        (void) unlink (output_filename);
>  }

You can still just remove the unlink(), or you can do this:

	if (lstat (output_filename, &stabuf) != -1) {
		if (!S_ISDIR(statbuf.st_mode))
			(void) unlink (output_filename);
	}

The unlink() is looking easier and easier all the time 8-).
I still think I want it to remove files, though.