directory existence test

This commit is contained in:
Adrien Schildknecht 2013-08-04 18:13:54 +02:00
parent 0d8f847bb9
commit 47a4a98da7

4
xcwd.c
View File

@ -237,6 +237,8 @@ static int readPath(struct proc_s *proc)
return 0; return 0;
} }
LOG("Read %s\n", path); LOG("Read %s\n", path);
if(access(buf, F_OK))
return 0;
fprintf(stdout, "%s\n", buf); fprintf(stdout, "%s\n", buf);
#endif #endif
#ifdef BSD #ifdef BSD
@ -244,6 +246,8 @@ static int readPath(struct proc_s *proc)
LOG("%ld cwd is empty\n", proc->pid); LOG("%ld cwd is empty\n", proc->pid);
return 0; return 0;
} }
if(access(proc->cwd, F_OK))
return 0;
fprintf(stdout, "%s\n", proc->cwd); fprintf(stdout, "%s\n", proc->cwd);
#endif #endif
return 1; return 1;