src/gtkmain.c

changeset 13106
cb7461d56b5e
parent 13094
dfbe0dea413b
child 13111
31caa48825f7
equal deleted inserted replaced
13105:8f9c66e4af87 13106:cb7461d56b5e
385 basebuf = g_find_program_in_path(argv0); 385 basebuf = g_find_program_in_path(argv0);
386 386
387 /* But we still need to deal with symbolic links */ 387 /* But we still need to deal with symbolic links */
388 g_lstat(basebuf, &st); 388 g_lstat(basebuf, &st);
389 while ((st.st_mode & S_IFLNK) == S_IFLNK) { 389 while ((st.st_mode & S_IFLNK) == S_IFLNK) {
390 int written;
390 linkbuf = g_malloc(1024); 391 linkbuf = g_malloc(1024);
391 readlink(basebuf, linkbuf, 1024); 392 written = readlink(basebuf, linkbuf, 1024 - 1);
393 if (written == -1)
394 {
395 /* This really shouldn't happen, but do we
396 * need something better here? */
397 g_free(linkbuf);
398 continue;
399 }
400 linkbuf[written] = '\0';
392 if (linkbuf[0] == G_DIR_SEPARATOR) { 401 if (linkbuf[0] == G_DIR_SEPARATOR) {
393 /* an absolute path */ 402 /* an absolute path */
394 fullbuf = g_strdup(linkbuf); 403 fullbuf = g_strdup(linkbuf);
395 } else { 404 } else {
396 char *dirbuf = g_path_get_dirname(basebuf); 405 char *dirbuf = g_path_get_dirname(basebuf);

mercurial