X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Ffile.c;h=839713f66bf418737f0a761fbfff21f0f399d6ba;hb=09d988e8f1cfa42ef9a5abe5c9c151962aa1d2cc;hp=0b50eebd7fa66b00a284d81e6b1647d91b4bcb28;hpb=b3035e8d7c04a71d9a54ab7e52bc9e169ecf0b47;p=libguestfs.git diff --git a/daemon/file.c b/daemon/file.c index 0b50eeb..839713f 100644 --- a/daemon/file.c +++ b/daemon/file.c @@ -520,3 +520,21 @@ do_zfile (const char *method, const char *path) return strdup (line); } + +int64_t +do_filesize (const char *path) +{ + int r; + struct stat buf; + + CHROOT_IN; + r = stat (path, &buf); /* follow symlinks */ + CHROOT_OUT; + + if (r == -1) { + reply_with_perror ("filesize: %s", path); + return -1; + } + + return buf.st_size; +}