2
* Copyright (C) 2002-2006 Novell/SUSE
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation, version 2 of the
14
#include <linux/types.h>
16
#include <linux/unistd.h>
18
#include <sys/syscall.h>
20
int main(int argc, char *argv[])
26
fprintf(stderr, "usage: %s dir\n",
31
fd = open(argv[1], O_RDONLY, 0);
33
printf("FAIL - open %s\n", strerror(errno));
38
if (fchdir(fd) == -1){
39
printf("FAIL - fchdir %s\n", strerror(errno));
44
/* getdents isn't exported by glibc, so must use syscall() */
45
if (syscall(SYS_getdents, fd, &dir, sizeof(struct dirent)) == -1){
46
printf("FAIL - getdents %s\n", strerror(errno));