Manual commit from my local git-svn which is broken :/

svn path=/trunk/; revision=2578
This commit is contained in:
Benoît Dejean
2007-05-13 08:20:10 +00:00
parent cd389851b9
commit 3eb958dc6c
24 changed files with 160 additions and 56 deletions

View File

@@ -184,3 +184,20 @@ has_sysfs(void)
return sysfs;
}
gboolean safe_readlink(const char *path, char *buf, size_t bufsiz)
{
ssize_t ret;
ret = readlink(path, buf, bufsiz - 1);
if (ret == -1) {
g_warning("Could not read link %s : %s", path, strerror(errno));
return FALSE;
}
buf[ret] = '\0';
return TRUE;
}