Why remove() doesn't remove (symbolic links)?

Melinda Shore shore at theory.tn.cornell.edu
Sat May 4 07:25:09 AEST 1991


In article <1991May03.202209.432 at lynx.CS.ORST.EDU> ghe at physics.orst.edu writes:
>Which way??? should remove or not??? TFM did not mention a single word on
>symbolic links.

I just checked MFM and it says that "if the named file is a symbolic
link to another file or directory, unlink [aka remove - ms] removes
the symbolic link, not the file or directory to which it refers."
Note the lengthy listings of error conditions at the end of the man
page.

> But TFM says nothing about errno. It only
>mentioned that 0 is returned upon successful completion, and non-zero
>otherwise. 

errno is a Unix thing, and you need to be familiar with it if you're
writing code that makes system calls and you want that code to be
reasonably robust.

>When I try to call remove(b) ('b' is a symbolic link to a directory 'a'),
>perror prints:
>remove: Not a directory

Probably because there's something wrong with either the pathname
you're passing to your program or the pathname your symlink points
to.  Does your program have the same problem with all symlinks?
-- 
                    Software longa, hardware brevis
Melinda Shore - Cornell Information Technologies - shore at theory.tn.cornell.edu



More information about the Comp.unix.aix mailing list