Alan Coopersmith <Alan.Coopersmith at Sun.COM> wrote:
> + g_unlink (GDM_SDTLOGIN_DIR);
>
> This seems to result in calling the unlink(2) system call (at
> least in the upstream code at [1]).
>
> As noted in the unlink(2) man page, unlink on a directory on
> Solaris UFS either fails (if not called by root) or corrupts the
> filesystem, requiring fsck to fix (if called by root).
>
> unlink on a directory on Solaris ZFS just fails for everyone.
>
> You should always use remove() instead of unlink() if the argument
> could ever be a directory. Perhaps glib's g_unlink() should be
> modified to just always call remove() instead, at least on Solaris.
This bug seems to be in many software developed on Linux. GIT also destroyed
directories by calling unlink() on non-empty directories.
For maximum portability, first call rmdir() and if errno is ENOTDIR,
call unlink(). AFAIK remove() was added to the standard ~ 10 years ago
and is not available everywhere.
J?rg
--
EMail:joerg at schily.isdn.cs.tu-berlin.de (home) J?rg Schilling D-13353 Berlin
js at cs.tu-berlin.de (uni)
joerg.schilling at fokus.fraunhofer.de (work) Blog:
http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily