X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=fuse%2Fguestmount.c;h=9b7e520adae2f895cb9a8f7122658f68494102cf;hp=df116196c6df0f3a0535561ae06abb0a4b62d89b;hb=4ea0abfce413767868a8f53b3d20e5d2f62dff08;hpb=f93cbe5756cf052cce8049087afdcf714a3fc70c diff --git a/fuse/guestmount.c b/fuse/guestmount.c index df11619..9b7e520 100644 --- a/fuse/guestmount.c +++ b/fuse/guestmount.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #include #include #include +#include #include #include @@ -652,7 +654,17 @@ fg_write (const char *path, const char *buf, size_t size, dir_cache_invalidate (path); - return -ENOSYS; /* XXX */ + /* See fg_read. */ + const size_t limit = 2 * 1024 * 1024; + if (size > limit) + size = limit; + + int r; + r = guestfs_pwrite (g, path, buf, size, offset); + if (r == -1) + return error (); + + return r; } static int @@ -927,7 +939,7 @@ main (int argc, char *argv[]) struct mp *mps = NULL; struct mp *mp; char *p; - int c, i, r; + int c, r; int option_index; struct sigaction sa; @@ -1063,9 +1075,12 @@ main (int argc, char *argv[]) guestfs_set_verbose (g, verbose); break; - case 'V': - printf ("%s %s\n", program_name, PACKAGE_VERSION); + case 'V': { + struct guestfs_version *v = guestfs_version (g); + printf ("%s %"PRIi64".%"PRIi64".%"PRIi64"%s\n", program_name, + v->major, v->minor, v->release, v->extra); exit (EXIT_SUCCESS); + } case HELP_OPTION: usage (EXIT_SUCCESS);