X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Ffile.c;h=839713f66bf418737f0a761fbfff21f0f399d6ba;hp=252c02c3f4caffe63238afe0dd8151b79994e3ec;hb=088d0c53cfe0dcb20b87707a9055175b2fd6b72f;hpb=9a8889e4d0c532b9f77af3a9cc7aae06adebfb83 diff --git a/daemon/file.c b/daemon/file.c index 252c02c..839713f 100644 --- a/daemon/file.c +++ b/daemon/file.c @@ -44,11 +44,7 @@ do_touch (const char *path) return -1; } -#ifdef HAVE_FUTIMENS r = futimens (fd, NULL); -#else - r = futimes (fd, NULL); -#endif if (r == -1) { reply_with_perror ("futimens: %s", path); close (fd); @@ -524,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; +}