Date: Fri, 08 Nov 2019 09:17:22 +0000 From: bugzilla-noreply@freebsd.org To: doc@FreeBSD.org Subject: [Bug 221331] [PATCH] update for unlink(2) manpage Message-ID: <bug-221331-9-iX2jNVACOg@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-221331-9@https.bugs.freebsd.org/bugzilla/>
index | next in thread | previous in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221331 Oleksandr Tymoshenko <gonzo@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |doc@FreeBSD.org Component|Documentation |Manual Pages Assignee|doc@FreeBSD.org |bugs@FreeBSD.org WHR <msl0000023508@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msl0000023508@gmail.com --- Comment #1 from WHR <msl0000023508@gmail.com> --- There was a case that unlink(2) may return EISDIR. Function kern_unlinkat calls namei(9) to find the parent directory of the file; it will return EISDIR if the requested path was '/'. Since '/' isn't a real link (but '/.' and '/..'), it can't be unlinked anyways. Test: # cat unlink.c #include <unistd.h> #include <stdio.h> int main(int argc, char **argv) { if(argc != 2) { fprintf(stderr, "Usage: %s <path>\n", argv[0]); return -1; } if(unlink(argv[1]) < 0) { perror(argv[1]); return 1; } return 0; } # gcc -Wall -O1 unlink.c -o unlink # ./unlink /etc/ /etc/: Operation not permitted # ./unlink /. /.: Operation not permitted # ./unlink / /: Is a directory -- You are receiving this mail because: You are on the CC list for the bug. You are the assignee for the bug.help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-221331-9-iX2jNVACOg>
