learned something new - remove is supposed to support directories on POSIX
This commit is contained in:
parent
4106cdcd2d
commit
0b240ccf52
1 changed files with 3 additions and 1 deletions
|
|
@ -1,7 +1,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
|
||||||
int remove(const char *path)
|
int remove(const char *path)
|
||||||
{
|
{
|
||||||
return syscall(SYS_unlink, path);
|
return (syscall(SYS_unlink, path) && errno == EISDIR)
|
||||||
|
? syscall(SYS_rmdir, path) : 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue