]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
check return value from snprintf to avoid FUSE errors. Potentially fixes #24.
authorMichael McCracken <mike.mccracken@canonical.com>
Fri, 8 May 2015 08:46:02 +0000 (04:46 -0400)
committerMichael McCracken <mike.mccracken@canonical.com>
Fri, 8 May 2015 08:51:53 +0000 (04:51 -0400)
Signed-off-by: Michael McCracken <mike.mccracken@canonical.com>
lxcfs.c

diff --git a/lxcfs.c b/lxcfs.c
index 1faee5f31894e678174dc302a663303e8b81fd50..8e9f639419efdf87d9ffb5cfb1ad69a2b810deab 100644 (file)
--- a/lxcfs.c
+++ b/lxcfs.c
@@ -2096,6 +2096,12 @@ static int proc_uptime_read(char *buf, size_t size, off_t offset,
        }
 
        total_len = snprintf(buf, size, "%ld %ld\n", reaperage, idletime);
+
+       if (total_len >= size){
+               d->size = size;
+               return size;
+       }
+
        d->size = total_len;
        return total_len;
 }