Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

chown(42, 43); chown(44, -1) produces wrong result #2

Open
AkihiroSuda opened this issue Apr 16, 2018 · 0 comments
Open

chown(42, 43); chown(44, -1) produces wrong result #2

AkihiroSuda opened this issue Apr 16, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@AkihiroSuda
Copy link
Member

Moved from rootless-containers/runrootless#19


expected result: 44:43
actual result: 44:0

#include <stdio.h>
#include <unistd.h>

int main(int ac, char *av[]){
  if (ac != 2) {
    fprintf(stderr, "usage: %s FILE\n", av[0]);
    return 1;
  }
  const char *path = av[1];
  if (chown(path, 42, 43) < 0) {
    perror("chown(42, 43)");
    return 1;
  }
  if (chown(path, 44, -1) < 0) {
    perror("chown(44, -1)");
    return 1;
  }
  return 0;
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant