Actually do an fd2path instead of hardcoded path
authorKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Apr 2014 01:01:10 +0000 (18:01 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Apr 2014 01:04:30 +0000 (18:04 -0700)
kern/src/syscall.c

index dbc9c18..3b16a53 100644 (file)
@@ -1731,7 +1731,10 @@ static intreg_t sys_fd2path(struct proc *p, int fd, void *u_buf, size_t len)
                return -1;
        }
        ch = fdtochan(current->fgrp, fd, -1, FALSE, TRUE);
-       ret = snprintf(u_buf, len, "%s", "chanpath(ch)");
+       if (ch->name != NULL) {
+               memmove(u_buf, ch->name->s, ch->name->len + 1);
+       }
+       ret = ch->name->len;
        cclose(ch);
        poperror();
        return ret;