1 |
/* GNU Hurd standard exec server, #! script execution support. |
/* GNU Hurd standard exec server, #! script execution support. |
2 |
Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc. |
Copyright (C) 1995,96,97,98,99,2000,02 Free Software Foundation, Inc. |
3 |
Written by Roland McGrath. |
Written by Roland McGrath. |
4 |
|
|
5 |
This file is part of the GNU Hurd. |
This file is part of the GNU Hurd. |
230 |
char *name; |
char *name; |
231 |
int free_name = 0; /* True if we should free NAME. */ |
int free_name = 0; /* True if we should free NAME. */ |
232 |
file_t name_file; |
file_t name_file; |
233 |
mach_port_t fileid; |
mach_port_t fileid, filefsid; |
|
dev_t filedev; |
|
234 |
ino_t fileno; |
ino_t fileno; |
235 |
|
|
236 |
/* Search $PATH for NAME, opening a port NAME_FILE on it. |
/* Search $PATH for NAME, opening a port NAME_FILE on it. |
260 |
return err; |
return err; |
261 |
} |
} |
262 |
|
|
263 |
error = io_identity (file, &fileid, &filedev, &fileno); |
error = io_identity (file, &fileid, &filefsid, &fileno); |
264 |
if (error) |
if (error) |
265 |
goto out; |
goto out; |
266 |
|
mach_port_deallocate (mach_task_self (), filefsid); |
267 |
|
|
268 |
if (memchr (argv, '\0', argvlen) == NULL) |
if (memchr (argv, '\0', argvlen) == NULL) |
269 |
{ |
{ |
284 |
|
|
285 |
if (!error && name_file != MACH_PORT_NULL) |
if (!error && name_file != MACH_PORT_NULL) |
286 |
{ |
{ |
287 |
mach_port_t id; |
mach_port_t id, fsid; |
|
dev_t dev; |
|
288 |
ino_t ino; |
ino_t ino; |
289 |
error = io_identity (name_file, &id, &dev, &ino); |
error = io_identity (name_file, &id, &fsid, &ino); |
290 |
mach_port_deallocate (mach_task_self (), id); |
mach_port_deallocate (mach_task_self (), name_file); |
291 |
|
if (!error) |
292 |
|
{ |
293 |
|
mach_port_deallocate (mach_task_self (), fsid); |
294 |
|
mach_port_deallocate (mach_task_self (), id); |
295 |
|
} |
296 |
if (!error && id == fileid) |
if (!error && id == fileid) |
297 |
{ |
{ |
298 |
file_name = name; |
file_name = name; |
300 |
} |
} |
301 |
else if (free_name) |
else if (free_name) |
302 |
free (name); |
free (name); |
|
mach_port_deallocate (mach_task_self (), name_file); |
|
303 |
} |
} |
304 |
|
|
305 |
mach_port_deallocate (mach_task_self (), fileid); |
mach_port_deallocate (mach_task_self (), fileid); |