summaryrefslogtreecommitdiffstats
path: root/man2/chown.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/chown.2')
-rw-r--r--man2/chown.214
1 files changed, 7 insertions, 7 deletions
diff --git a/man2/chown.2 b/man2/chown.2
index fe1906b7d..32b17fbdc 100644
--- a/man2/chown.2
+++ b/man2/chown.2
@@ -428,36 +428,36 @@ to perform a lookup in the system password file).
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-
+\&
int
main(int argc, char *argv[])
{
char *endptr;
uid_t uid;
struct passwd *pwd;
-
+\&
if (argc != 3 || argv[1][0] == \[aq]\e0\[aq]) {
fprintf(stderr, "%s <owner> <file>\en", argv[0]);
exit(EXIT_FAILURE);
}
-
+\&
uid = strtol(argv[1], &endptr, 10); /* Allow a numeric string */
-
+\&
if (*endptr != \[aq]\e0\[aq]) { /* Was not pure numeric string */
pwd = getpwnam(argv[1]); /* Try getting UID for username */
if (pwd == NULL) {
perror("getpwnam");
exit(EXIT_FAILURE);
}
-
+\&
uid = pwd\->pw_uid;
}
-
+\&
if (chown(argv[2], uid, \-1) == \-1) {
perror("chown");
exit(EXIT_FAILURE);
}
-
+\&
exit(EXIT_SUCCESS);
}
.EE