* fhandler_process.cc (fhandler_process::fill_filebuf): Disable

stripping the .exe suffix from the link target in PROCESS_EXE and
	PROCESS_EXENAME case.
	* path.cc (realpath): Tack on .exe suffix if necessary.
This commit is contained in:
Corinna Vinschen 2006-01-24 17:40:55 +00:00
parent 3acaaf543f
commit 4aac2d2709
3 changed files with 28 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2006-01-24 Corinna Vinschen <corinna@vinschen.de>
* fhandler_process.cc (fhandler_process::fill_filebuf): Disable
stripping the .exe suffix from the link target in PROCESS_EXE and
PROCESS_EXENAME case.
* path.cc (realpath): Tack on .exe suffix if necessary.
2006-01-24 Corinna Vinschen <corinna@vinschen.de> 2006-01-24 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Try harder * fhandler_disk_file.cc (fhandler_base::fstat_helper): Try harder

View File

@ -450,6 +450,11 @@ fhandler_process::fill_filebuf ()
else else
{ {
mount_table->conv_to_posix_path (p->progname, filebuf, 1); mount_table->conv_to_posix_path (p->progname, filebuf, 1);
#if 0
/* Temporarily disabled. The link will have a suffix so that
an open(2) call will succeed on /proc/$PID/exe now. This
might become unnecessary if open(2) handles the .exe suffix
at one point. */
int len = strlen (filebuf); int len = strlen (filebuf);
if (len > 4) if (len > 4)
{ {
@ -457,6 +462,7 @@ fhandler_process::fill_filebuf ()
if (strcasematch (s, ".exe")) if (strcasematch (s, ".exe"))
*s = 0; *s = 0;
} }
#endif
} }
filesize = strlen (filebuf); filesize = strlen (filebuf);
break; break;

View File

@ -3723,13 +3723,26 @@ realpath (const char *path, char *resolved)
if (!real_path.error && real_path.exists ()) if (!real_path.error && real_path.exists ())
{ {
/* Check for the suffix being tacked on. */
int tack_on = 0;
if (real_path.known_suffix)
{
char *c = strrchr (real_path.normalized_path, '.');
if (!c || !strcasematch (c, real_path.known_suffix))
tack_on = strlen (real_path.known_suffix);
}
if (!resolved) if (!resolved)
{ {
resolved = (char *) malloc (strlen (real_path.normalized_path) + 1); resolved = (char *) malloc (strlen (real_path.normalized_path)
+ tack_on + 1);
if (!resolved) if (!resolved)
return NULL; return NULL;
} }
return strcpy (resolved, real_path.normalized_path); strcpy (resolved, real_path.normalized_path);
if (tack_on)
strcat (resolved, real_path.known_suffix);
return resolved;
} }
/* FIXME: on error, we are supposed to put the name of the path /* FIXME: on error, we are supposed to put the name of the path