From: Johannes Sixt Date: Wed, 28 Feb 2007 17:18:52 GMT Subject: Re: [PATCH] Create a symbolic link as a regular file on filesystems without symlinks. Message-ID: <200702281818.52668.johannes.sixt@telecom.at> In-Reply-To: On Tuesday 27 February 2007 23:44, Johannes Schindelin wrote: > On Tue, 27 Feb 2007, Johannes Sixt wrote: > > - if (S_ISLNK(mode)) > > + if (trust_symlink_fmt && S_ISLNK(mode)) > > First of all why "_fmt"? I would have called it "trust_symlinks". Because the file type is encoded in a mask named S_IFMT ;) But the more I think about it, I'll rename it to has_symlinks. > Wouldn't this be better: > > - if (to_tempfile) { > - strcpy(path, ".merge_link_XXXXXX"); > - fd = mkstemp(path); > + if (to_tempfile || !trusk_symlink_fmt) { > + if (to_tempfile) { > + strcpy(path, ".merge_link_XXXXXX"); > + fd = mkstemp(path); > + } else > + fd = create_file(path, 0666); > > Hmm? Sure; it amounts to the same, but is shorter. -- Hannes