# HG changeset patch # User Richard Laager # Date 1138910597 0 # Node ID e347b2217b1b3800710e77e2f24c2e4123c662e4 # Parent e1e5462b7d8185d42c5e05136f2164d696031ebf [gaim-migrate @ 15467] I think this fixes a bug with readlink, and somewhat handles an error condition that is not likely to happen. committer: Tailor Script diff -r e1e5462b7d81 -r e347b2217b1b src/gtkmain.c --- a/src/gtkmain.c Thu Feb 02 19:50:51 2006 +0000 +++ b/src/gtkmain.c Thu Feb 02 20:03:17 2006 +0000 @@ -387,8 +387,17 @@ /* But we still need to deal with symbolic links */ g_lstat(basebuf, &st); while ((st.st_mode & S_IFLNK) == S_IFLNK) { + int written; linkbuf = g_malloc(1024); - readlink(basebuf, linkbuf, 1024); + written = readlink(basebuf, linkbuf, 1024 - 1); + if (written == -1) + { + /* This really shouldn't happen, but do we + * need something better here? */ + g_free(linkbuf); + continue; + } + linkbuf[written] = '\0'; if (linkbuf[0] == G_DIR_SEPARATOR) { /* an absolute path */ fullbuf = g_strdup(linkbuf);