Skip to content
Permalink
Browse files

Clobber a Link if it's in the way of a File

  • Loading branch information...
isaacs committed May 15, 2019
1 parent 1e4527f commit 6a77d2fa6e1462693cf8e46f930da96ec1b0bb22
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/writer.js
@@ -147,7 +147,7 @@ Writer.prototype._stat = function (current) {

// if it's a type change, then we need to clobber or error.
// if it's not a type change, then let the impl take care of it.
if (currentType !== self.type) {
if (currentType !== self.type || self.type === 'File' && current.nlink > 1) {
return rimraf(self._path, function (er) {
if (er) return self.error(er)
self._old = null

1 comment on commit 6a77d2f

@ret2libc

This comment has been minimized.

Copy link

commented on 6a77d2f Jun 24, 2019

Does this fix really solve the issue? Doesn't it make it just racy? (e.g. if at the time of check the file is a regular one and it is switched to an hardlink just before the create() function is called)

Please sign in to comment.
You can’t perform that action at this time.