remove() only works on files
Eric Blake
eblake@redhat.com
Fri Apr 15 19:09:00 GMT 2011
On 04/15/2011 05:16 AM, Schwarz, Konrad wrote:
>> -----Original Message-----
>> From: newlib-owner@sourceware.org
>> [mailto:newlib-owner@sourceware.org] On Behalf Of David A. Ramos
>> Sent: Friday, April 15, 2011 9:10 AM
>> To: newlib@sourceware.org
>> Subject: Bug: remove() only works on files
>
>> My understanding of ISO C's remove() function is that it
>> should work for both files and directories. That is, it
>> should call unlink() or rmdir(), respectively. However, the
>> code in newlib/libc/stdio/remove.c just forwards the call to
>> unlink(), which fails for directories.
>
> Standard C's library does not know about heirarchical file systems
> -- there is no way of creating, deleting, or listing directories.
>
> remove() is specified only for files.
Wrong. POSIX explicitly requires remove() to work on all file types,
including directories, as an extension to C99:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/remove.html
--
Eric Blake eblake@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20110415/e0a4d295/attachment.sig>
More information about the Newlib
mailing list