forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6d25eb3
committed
Allow "-C variable" and "--describe-config" even to root users.
There's no really compelling reason to refuse to do these read-only,non-server-starting options as root, and there's at least one goodreason to allow -C: pg_ctl uses -C to find out the true data directorylocation when pointed at a config-only directory. On Windows, this isdone before dropping administrator privileges, which means that pg_ctlfails for administrators if and only if a config-only layout is used.Since the root-privilege check is done so early in startup, it's a bitawkward to check for these switches. Make the somewhat arbitrarydecision that we'll only skip the root check if -C is the first switch.This is not just to make the code a bit simpler: it also guarantees thatwe can't misinterpret a --boot mode switch. (While AuxiliaryProcessMaindoesn't currently recognize any such switch, it might have one in thefuture.) This is no particular problem for pg_ctl, and since the wholebehavior is undocumented anyhow, it's not a documentation issue either.(--describe-config only works as the first switch anyway, so this isno restriction for that case either.)Back-patch to 9.2 where pg_ctl first began to use -C.MauMau, heavily edited by me1 parented1cb42 commit6d25eb3
2 files changed
+28
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
159 | | - | |
| 161 | + | |
| 162 | + | |
160 | 163 | | |
161 | 164 | | |
162 | 165 | | |
| |||
170 | 173 | | |
171 | 174 | | |
172 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
173 | 191 | | |
174 | 192 | | |
175 | 193 | | |
176 | | - | |
| 194 | + | |
| 195 | + | |
177 | 196 | | |
178 | | - | |
| 197 | + | |
| 198 | + | |
179 | 199 | | |
180 | 200 | | |
181 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1968 | 1968 | | |
1969 | 1969 | | |
1970 | 1970 | | |
1971 | | - | |
1972 | | - | |
1973 | | - | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
1974 | 1976 | | |
1975 | 1977 | | |
1976 | 1978 | | |
| |||
0 commit comments
Comments
(0)