Mercurial > pidgin
changeset 13105:e347b2217b1b
[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 <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 02 Feb 2006 20:03:17 +0000 |
parents | e1e5462b7d81 |
children | a0a4b44239e8 |
files | src/gtkmain.c |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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);