177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
-
-
+
+
|
static void FindAndSetExecName(Tcl_Interp *interp) {
int len = 0;
Tcl_Obj *execNameObj;
Tcl_Obj *lobjv[1];
#if defined(HAVE_READLINK)
ssize_t readlink_ret;
char procpath[PATH_MAX + 1];
char exe_buf[PATH_MAX + 1];
char procpath[4096];
char exe_buf[4096];
int snprintf_ret;
if (Tcl_GetNameOfExecutable() == NULL) {
snprintf_ret = snprintf(procpath, sizeof(procpath), "/proc/%lu/exe", (unsigned long) getpid());
if (snprintf_ret < sizeof(procpath)) {
readlink_ret = readlink(procpath, exe_buf, sizeof(exe_buf) - 1);
|