Unverified Commit 2f3e6f53 authored by Saleem Abdulrasool's avatar Saleem Abdulrasool Committed by GitHub
Browse files

pk: correct the handling of SYS_getcwd (#250)

`SYS_getcwd` is different from `getcwd` in that the return value is < 0
on failure otherwise it is the length of the string.  The proxy kernel
was treating 0 as success and all other values as error.  As a result,
we would never return a valid value for `getcwd`.

The following program now executes properly with the Proxy Kernel:
  ```c
  #include <stdio.h>
  #include <stdlib.h>
  #include <unistd.h>

  #include <linux/limits.h>

  int main(int argc, char **argv) {
    unsigned char buffer[PATH_MAX + 1] = {0};
    if (getcwd(buffer, PATH_MAX))
      printf("cwd: %s\n", buffer);
    return EXIT_SUCCESS;
  }
  ```
parent 8e29c382
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment