Date: Thu, 22 Jun 1995 20:36:05 -0700 From: asami@cs.berkeley.edu (Satoshi Asami) To: jkh@freebsd.org Cc: ports@freebsd.org, sa2c@and.or.jp Subject: symbolic links and access() in pkg_delete Message-ID: <199506230336.UAA01243@silvia.HIP.Berkeley.EDU>
next in thread | raw e-mail | index | archive | help
It was brought to my attention that pkg_delete doesn't work when a target of a symbolic link is deleted before the link itself. A look through the source reveals this: /usr/src/usr.sbin/pkg_install/lib/file.c: ======= /* Quick check to see if a file exists */ Boolean fexists(char *fname) { if (!access(fname, F_OK)) return TRUE; return FALSE; } ======= This returns -1 when the named file is a symbolic link and the target doesn't exist. Would it be the end of the world if I add a check using lstat() in case access() fails? Actually, I'm not sure what the implications of using access() vs. lstat() is, maybe we can just replace it with lstat()? Satoshi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199506230336.UAA01243>