diff options
| author | Richard M. Stallman | 1994-09-29 23:20:43 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-09-29 23:20:43 +0000 |
| commit | b2728f4bdef6c98089669447fcc4b04d133b1ef7 (patch) | |
| tree | c8dba9f8ef08b52018ab6845d5fc9f3a9c5fbf6c /src | |
| parent | c820123b60386cc62e238d76f6a4cb1e93d0e059 (diff) | |
| download | emacs-b2728f4bdef6c98089669447fcc4b04d133b1ef7.tar.gz emacs-b2728f4bdef6c98089669447fcc4b04d133b1ef7.zip | |
(check_writable, check_executable) [__HURD__]: Use eaccess.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/src/fileio.c b/src/fileio.c index a06032a3cae..42290b8ecaa 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2177,19 +2177,7 @@ check_executable (filename) | |||
| 2177 | char *filename; | 2177 | char *filename; |
| 2178 | { | 2178 | { |
| 2179 | #ifdef __HURD__ | 2179 | #ifdef __HURD__ |
| 2180 | mach_port_t file; | 2180 | return (eaccess (filename, 1) >= 0); |
| 2181 | int access_mode; | ||
| 2182 | |||
| 2183 | file = path_lookup (filename, 0, 0); | ||
| 2184 | if (file == MACH_PORT_NULL) | ||
| 2185 | /* File can't be opened. */ | ||
| 2186 | access_mode = 0; | ||
| 2187 | else | ||
| 2188 | { | ||
| 2189 | file_access (file, &access_mode); | ||
| 2190 | mach_port_deallocate (mach_task_self (), file); | ||
| 2191 | } | ||
| 2192 | return !!(access_mode & O_EXEC); | ||
| 2193 | #else | 2181 | #else |
| 2194 | /* Access isn't quite right because it uses the real uid | 2182 | /* Access isn't quite right because it uses the real uid |
| 2195 | and we really want to test with the effective uid. | 2183 | and we really want to test with the effective uid. |
| @@ -2205,19 +2193,7 @@ check_writable (filename) | |||
| 2205 | char *filename; | 2193 | char *filename; |
| 2206 | { | 2194 | { |
| 2207 | #ifdef __HURD__ | 2195 | #ifdef __HURD__ |
| 2208 | mach_port_t file; | 2196 | return (eaccess (filename, 2) >= 0); |
| 2209 | int access_mode; | ||
| 2210 | |||
| 2211 | file = path_lookup (filename, 0, 0); | ||
| 2212 | if (file == MACH_PORT_NULL) | ||
| 2213 | /* File can't be opened. */ | ||
| 2214 | access_mode = 0; | ||
| 2215 | else | ||
| 2216 | { | ||
| 2217 | file_access (file, &access_mode); | ||
| 2218 | mach_port_deallocate (mach_task_self (), file); | ||
| 2219 | } | ||
| 2220 | return !!(access_mode & O_WRITE); | ||
| 2221 | #else | 2197 | #else |
| 2222 | /* Access isn't quite right because it uses the real uid | 2198 | /* Access isn't quite right because it uses the real uid |
| 2223 | and we really want to test with the effective uid. | 2199 | and we really want to test with the effective uid. |