Skip to content

Commit

Permalink
lofs: remove of a symlink should use lstat
Browse files Browse the repository at this point in the history
A symlink can be dangling, which means that `stat` will return `ENOENT`.
When removing we want to remove the symlink itself so `lstat` is
appropriate.

Signed-off-by: David Scott <dave.scott@unikernel.com>
  • Loading branch information
djs55 committed Nov 30, 2015
1 parent 0b0ef56 commit 6879bf4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion unix/lofs9p.ml
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ module New(Params : sig val root : string list end) = struct
let rec loop () =
Lwt.catch
(fun () ->
Lwt_unix.LargeFile.stat realpath
Lwt_unix.LargeFile.lstat realpath
>>= fun stats ->
( if stats.Lwt_unix.LargeFile.st_kind = Lwt_unix.S_DIR
then Lwt_unix.rmdir else Lwt_unix.unlink ) realpath
Expand Down

0 comments on commit 6879bf4

Please sign in to comment.