annotate lib/pt_chown.c @ 17363:5a51fb7777a9

sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin Problem reported by Marco Atzeri in <http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00000.html>. * lib/sys_select.in.h [HAVE_SYS_SELECT_H && _CYGWIN_SYS_TIME_H]: Simply delegate to the system <sys/select.h> in this case too. Also, pay attention to _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H only if OSF/1, since otherwise Cygwin breaks, and it doesn't seem to be needed on Solaris either. * lib/sys_time.in.h [_CYGWIN_SYS_TIME_H]: Simply delgate to the system <sys/time.h> in this case.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 19 Mar 2013 09:08:47 -0700
parents e542fd46ad6f
children 344018b6e5d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16235
18a38c9615f0 In commentary, do not use ` to quote.
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
1 /* pt_chown - helper program for 'grantpt'.
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16951
diff changeset
2 Copyright (C) 1998-1999, 2009-2013 Free Software Foundation, Inc.
13027
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 Contributed by C. Scott Ananian <cananian@alumni.princeton.edu>, 1998.
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 (at your option) any later version.
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #include <config.h>
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 #include <errno.h>
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <grp.h>
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #include <stdio.h>
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #include <stdlib.h>
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 #include <string.h>
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 #include <sys/stat.h>
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #include <unistd.h>
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
16951
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16235
diff changeset
28 #include "root-uid.h"
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16235
diff changeset
29
13027
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 #include "pty-private.h"
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 /* For security reasons, we try to minimize the dependencies on libraries
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 outside libc. This means, in particular:
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 - No use of gettext(), since it's usually implemented in libintl.
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 - No use of error() or argp, since they rely on gettext by default. */
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 static int
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 do_pt_chown (void)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 char *pty;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 struct stat st;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 struct group *p;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 gid_t gid;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 /* Check that PTY_FILENO is a valid master pseudo terminal. */
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 pty = ptsname (PTY_FILENO);
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 if (pty == NULL)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 return errno == EBADF ? FAIL_EBADF : FAIL_EINVAL;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 /* Check that the returned slave pseudo terminal is a
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 character device. */
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 if (stat (pty, &st) < 0 || !S_ISCHR (st.st_mode))
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 return FAIL_EINVAL;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55
16235
18a38c9615f0 In commentary, do not use ` to quote.
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
56 /* Get the group ID of the special 'tty' group. */
13027
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 p = getgrnam (TTY_GROUP);
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 gid = p ? p->gr_gid : getgid ();
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 /* Set the owner to the real user ID, and the group to that special
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 group ID. */
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 if (st.st_gid != gid && chown (pty, getuid (), gid) < 0)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 return FAIL_EACCES;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 /* Set the permission mode to readable and writable by the owner,
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 and writable by the group. */
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 if ((st.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO)) != (S_IRUSR|S_IWUSR|S_IWGRP)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 && chmod (pty, S_IRUSR|S_IWUSR|S_IWGRP) < 0)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 return FAIL_EACCES;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 return 0;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 }
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 int
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 main (int argc, char *argv[])
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 uid_t euid = geteuid ();
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79
16951
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16235
diff changeset
80 if (argc == 1 && euid == ROOT_UID)
13027
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82 /* Normal invocation of this program is with no arguments and
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83 with privileges. */
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
84 return do_pt_chown ();
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 }
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86
13046
81c0a49eb40d pt_chown: Don't depend on GPLed modules.
Bruno Haible <bruno@clisp.org>
parents: 13027
diff changeset
87 /* It would be possible to drop setuid/setgid privileges here. But it is not
81c0a49eb40d pt_chown: Don't depend on GPLed modules.
Bruno Haible <bruno@clisp.org>
parents: 13027
diff changeset
88 really needed, since the code below only calls strcmp and [f]printf. */
13027
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 int do_help = 0;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 int do_version = 0;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 int remaining;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 for (remaining = 1; remaining < argc; remaining++)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 const char *arg = argv[remaining];
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 if (arg[0] == '-')
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 if (strcmp (arg, "--") == 0)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 remaining++;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104 break;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 }
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106 else if (strcmp (arg, "--help") == 0)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107 do_help = 1;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 else if (strcmp (arg, "--version") == 0)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 do_version = 1;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 else
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
112 fprintf (stderr, "pt_chown: invalid option: %s\n", arg);
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113 return EXIT_FAILURE;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 }
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115 }
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116 else
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
117 break;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 }
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
119
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 if (remaining < argc)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122 fprintf (stderr, "pt_chown: too many arguments\n");
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123 return EXIT_FAILURE;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 }
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 if (do_help)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 printf ("Usage: pt_chown [OPTION...]\n");
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 printf ("Set the owner, group and access permission of the slave pseudo terminal\n"
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 "corresponding to the master pseudo terminal passed on file descriptor %d.\n"
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 "This is the helper program for the 'grantpt' function. It is not intended\n"
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 "to be run directly from the command line.\n",
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 PTY_FILENO);
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 printf ("\n");
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135 printf (" --help Give this help list\n");
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 printf (" --version Print program version\n");
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 printf ("\n");
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 printf ("The owner is set to the current user, the group is set to '%s', and the\n"
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 "access permission is set to '%o'.\n",
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
140 TTY_GROUP, S_IRUSR|S_IWUSR|S_IWGRP);
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
141 printf ("Please report bugs to <bug-gnulib@gnu.org>.\n");
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
142 return EXIT_SUCCESS;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
143 }
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
145 if (do_version)
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
147 printf ("pt_chown (GNU %s) %s\n", "libc", "2.11");
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148 printf ("Copyright (C) %s Free Software Foundation, Inc.\n"
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
149 "This is free software; see the source for copying conditions. There is NO\n"
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
150 "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
151 "1999");
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
152 return EXIT_SUCCESS;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
153 }
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154 }
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 /* Check if we are properly installed. */
16951
9009d83acea4 root-uid: new module
Paul Eggert <eggert@cs.ucla.edu>
parents: 16235
diff changeset
157 if (euid != ROOT_UID)
13027
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
158 {
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
159 fprintf (stderr, "pt_chown: needs to be installed setuid 'root'\n");
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
160 return FAIL_EXEC;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
161 }
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
162
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
163 return EXIT_SUCCESS;
6c6cd9627a48 New module 'pt_chown'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
164 }