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

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

@AkihiroSuda

Description

@AkihiroSuda

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions