diff options
Diffstat (limited to 'src/lib9')
-rw-r--r-- | src/lib9/dirread.c | 8 | ||||
-rw-r--r-- | src/lib9/rfork.c | 14 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/lib9/dirread.c b/src/lib9/dirread.c index 5aa5c449..4105e878 100644 --- a/src/lib9/dirread.c +++ b/src/lib9/dirread.c @@ -50,8 +50,7 @@ countde(char *p, int n) de->d_name[0] = 0; else if(de->d_name[0]=='.' && de->d_name[1]=='.' && de->d_name[2]==0) de->d_name[0] = 0; - else - m++; + m++; p += de->d_reclen; } return m; @@ -78,9 +77,12 @@ dirpackage(int fd, char *buf, int n, Dir **dp) p = buf; nstr = 0; + for(i=0; i<n; i++){ de = (struct dirent*)p; - if(stat(de->d_name, &st) < 0) + if(de->d_name[0] == 0) + /* nothing */ {} + else if(stat(de->d_name, &st) < 0) de->d_name[0] = 0; else nstr += _p9dir(&st, de->d_name, nil, nil, nil); diff --git a/src/lib9/rfork.c b/src/lib9/rfork.c index 41d3f9d6..270c3cdd 100644 --- a/src/lib9/rfork.c +++ b/src/lib9/rfork.c @@ -4,6 +4,20 @@ int p9rfork(int flags) { + int pid; + + if((flags&(RFPROC|RFFDG|RFMEM)) == (RFPROC|RFFDG)){ + /* check other flags before we commit */ + flags &= ~(RFPROC|RFFDG); + if(flags & ~(RFNOTEG)){ + werrstr("unknown flags %08ux in rfork", flags); + return -1; + } + pid = fork(); + if(pid != 0) + return pid; + } + if(flags&RFPROC){ werrstr("cannot use rfork to fork -- use ffork"); return -1; |