--- a/libpurple/internal.h Tue May 13 12:02:54 2014 +0200
+++ b/libpurple/internal.h Tue May 13 13:13:57 2014 +0200
@@ -354,4 +354,15 @@
_purple_network_set_common_socket_flags(int fd);
+ * A fstat alternative, like g_stat for stat. + * @param fd The file descriptor. + * @param st The stat buffer. + * @return the result just like for fstat. +_purple_fstat(int fd, GStatBuf *st); #endif /* _PURPLE_INTERNAL_H_ */
--- a/libpurple/log.c Tue May 13 12:02:54 2014 +0200
+++ b/libpurple/log.c Tue May 13 13:13:57 2014 +0200
@@ -1732,7 +1732,7 @@
- if (fstat(file_fd, &st) == -1) {
+ if (_purple_fstat(file_fd, &st) == -1) { purple_stringref_unref(pathref);
@@ -1745,7 +1745,7 @@
index_fd = g_open(pathstr, 0, O_RDONLY);
- if (fstat(index_fd, &st) != 0) {
+ if (_purple_fstat(index_fd, &st) != 0) { --- a/libpurple/protocols/silc/util.c Tue May 13 12:02:54 2014 +0200
+++ b/libpurple/protocols/silc/util.c Tue May 13 13:13:57 2014 +0200
@@ -68,26 +68,6 @@
-/* there is no fstat alternative for GStatBuf */
-static int g_fstat(int fd, GStatBuf *st)
- g_return_val_if_fail(st != NULL, -1);
- memset(st, 0, sizeof(GStatBuf));
- /* only these two are used here */
- st->st_uid = sst.st_uid;
- st->st_mode = sst.st_mode;
/* This checks stats for various SILC files and directories. First it
checks if ~/.silc directory exist and is owned by the correct user. If
it doesn't exist, it will create the directory. After that it checks if
@@ -213,7 +193,7 @@
if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) {
- if ((g_fstat(fd, &st)) == -1) {
+ if (_purple_fstat(fd, &st) == -1) { purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
file_private_key, g_strerror(errno));
@@ -235,7 +215,7 @@
if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) {
- if ((g_fstat(fd, &st)) == -1) {
+ if (_purple_fstat(fd, &st) == -1) { purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n",
file_private_key, g_strerror(errno));
--- a/libpurple/util.c Tue May 13 12:02:54 2014 +0200
+++ b/libpurple/util.c Tue May 13 13:13:57 2014 +0200
@@ -4961,6 +4961,22 @@
+_purple_fstat(int fd, GStatBuf *st) + g_return_val_if_fail(st != NULL, -1); /* Temporarily removed - re-add this when you need ini file support. */
@@ -4975,7 +4991,7 @@
const gchar *header = "[default]\n\n";
int header_len = strlen(header);
gsize file_size, buff_size;
@@ -4993,7 +5009,7 @@
- if (fstat(fd, &st) != 0) {
+ if (_purple_fstat(fd, &st) != 0) { purple_debug_error("util", "Failed to fstat ini file %s", file);