Skip to content

Commit

Permalink
Deal with C tests running as root.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin authored and dormando committed Aug 29, 2009
1 parent 4f56793 commit 9a0357e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions testapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ static pid_t start_server(in_port_t *port_out, bool daemon) {
argv[arg++] = "-1";
argv[arg++] = "-U";
argv[arg++] = "0";
/* Handle rpmbuild and the like doing this as root */
if (getuid() == 0) {
argv[arg++] = "-u";
argv[arg++] = "root";
}
if (daemon) {
argv[arg++] = "-d";
argv[arg++] = "-P";
Expand Down

0 comments on commit 9a0357e

Please sign in to comment.