]> Git Repo - uclibc-ng.git/blame - libc/stdio/remove.c
make sure TARGET_ARCH is set ... thought i committed this already?
[uclibc-ng.git] / libc / stdio / remove.c
CommitLineData
082e680b
MNI
1/* Copyright (C) 2004 Manuel Novoa III <[email protected]>
2 *
3 * GNU Library General Public License (LGPL) version 2 or later.
4 *
5 * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
6 */
7
8#include "_stdio.h"
9
10#include <unistd.h>
11#include <errno.h>
12
13/* SUSv3 states:
14 * If path does not name a directory, remove(path) shall be equivalent
15 * to unlink(path). If path names a directory, remove(path) shall be
16 * equivalent to rmdir(path).
17 */
18
19int remove(register const char *filename)
20{
21 int saved_errno = errno;
22 int rv;
23
24 if (((rv = rmdir(filename)) < 0) && (errno == ENOTDIR)) {
25 __set_errno(saved_errno); /* Need to restore errno. */
26 rv = unlink(filename);
27 }
28 return rv;
29}
This page took 0.048952 seconds and 4 git commands to generate.