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

Haiyan Wang wangh at beasley.CS.ORST.EDU
Sat May 4 12:58:53 AEST 1991


In article <1991May3.212509.6542 at batcomputer.tn.cornell.edu> shore at theory.tn.cornell.edu (Melinda Shore) writes:
>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.

Are you sure you're reading AIX3.1 manual of remove()? I saved the man
page into a file and searched the file with grep and could not find the word
symbolic. Maybe the man page on our system is screwed up somehow? :-(. 

>
>> 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?

It is not likely to have something wrong with the pathname. I used the same
program on other files and work fine. And same problem happened on different
symbolic links. 

>-- 
>                    Software longa, hardware brevis
>Melinda Shore - Cornell Information Technologies - shore at theory.tn.cornell.edu

Guangliang He
ghe at physics.orst.edu

I'm using someonelse's account over the weekend.



More information about the Comp.unix.aix mailing list