From 47a4a98da72f29e48c4b133e4d0d00a063e242db Mon Sep 17 00:00:00 2001 From: Adrien Schildknecht Date: Sun, 4 Aug 2013 18:13:54 +0200 Subject: [PATCH] directory existence test --- xcwd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xcwd.c b/xcwd.c index 3528af4..4cabf83 100644 --- a/xcwd.c +++ b/xcwd.c @@ -237,6 +237,8 @@ static int readPath(struct proc_s *proc) return 0; } LOG("Read %s\n", path); + if(access(buf, F_OK)) + return 0; fprintf(stdout, "%s\n", buf); #endif #ifdef BSD @@ -244,6 +246,8 @@ static int readPath(struct proc_s *proc) LOG("%ld cwd is empty\n", proc->pid); return 0; } + if(access(proc->cwd, F_OK)) + return 0; fprintf(stdout, "%s\n", proc->cwd); #endif return 1;