Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!ogicse!orstcs!beasley!wangh From: wangh@beasley.CS.ORST.EDU (Haiyan Wang) Newsgroups: comp.unix.aix Subject: Re: Why remove() doesn't remove (symbolic links)? Keywords: remove(), symbolic link Message-ID: <1991May04.025853.11037@lynx.CS.ORST.EDU> Date: 4 May 91 02:58:53 GMT References: <1991May3.185244.1275@batcomputer.tn.cornell.edu> <1991May03.202209.432@lynx.CS.ORST.EDU> <1991May3.212509.6542@batcomputer.tn.cornell.edu> Sender: @lynx.CS.ORST.EDU Organization: Oregon State University - Computing Services Lines: 44 Nntp-Posting-Host: ucs.orst.edu In article <1991May3.212509.6542@batcomputer.tn.cornell.edu> shore@theory.tn.cornell.edu (Melinda Shore) writes: >In article <1991May03.202209.432@lynx.CS.ORST.EDU> ghe@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@theory.tn.cornell.edu Guangliang He ghe@physics.orst.edu I'm using someonelse's account over the weekend.