X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=fuse%2Fguestmount.c;h=05cacef0fec775c1afd286f7fbba06d731d77783;hb=f4619c24e2a5cceaf030ee015a5c005b5a84280c;hp=c7220c0811c7f969c0a4cd35f993d4a8e3c6cb2e;hpb=9a8889e4d0c532b9f77af3a9cc7aae06adebfb83;p=libguestfs.git diff --git a/fuse/guestmount.c b/fuse/guestmount.c index c7220c0..05cacef 100644 --- a/fuse/guestmount.c +++ b/fuse/guestmount.c @@ -46,6 +46,7 @@ #include "progname.h" +#include "guestmount.h" #include "dircache.h" /* See */ @@ -53,21 +54,6 @@ #define ENOATTR ENODATA #endif -#ifdef HAVE_GETTEXT -#include "gettext.h" -#define _(str) dgettext(PACKAGE, (str)) -//#define N_(str) dgettext(PACKAGE, (str)) -#else -#define _(str) str -//#define N_(str) str -#endif - -static inline char * -bad_cast (char const *s) -{ - return (char *) s; -} - static guestfs_h *g = NULL; static int read_only = 0; int verbose = 0; @@ -360,8 +346,10 @@ fg_readlink (const char *path, char *buf, size_t size) memcpy (buf, r, len); buf[len] = '\0'; - if (free_it) - free ((char *) r); + if (free_it) { + char *tmp = (char *) r; + free (tmp); + } return 0; } @@ -439,7 +427,7 @@ fg_symlink (const char *from, const char *to) dir_cache_invalidate (to); - r = guestfs_ln_s (g, to, from); + r = guestfs_ln_s (g, from, to); if (r == -1) return error (); @@ -453,6 +441,7 @@ fg_rename (const char *from, const char *to) if (read_only) return -EROFS; + dir_cache_invalidate (from); dir_cache_invalidate (to); /* XXX It's not clear how close the 'mv' command is to the @@ -473,9 +462,10 @@ fg_link (const char *from, const char *to) if (read_only) return -EROFS; + dir_cache_invalidate (from); dir_cache_invalidate (to); - r = guestfs_ln (g, to, from); + r = guestfs_ln (g, from, to); if (r == -1) return error (); @@ -544,14 +534,22 @@ fg_utimens (const char *path, const struct timespec ts[2]) time_t mtsecs = ts[1].tv_sec; long mtnsecs = ts[1].tv_nsec; +#ifdef UTIME_NOW if (atnsecs == UTIME_NOW) atnsecs = -1; +#endif +#ifdef UTIME_OMIT if (atnsecs == UTIME_OMIT) atnsecs = -2; +#endif +#ifdef UTIME_NOW if (mtnsecs == UTIME_NOW) mtnsecs = -1; +#endif +#ifdef UTIME_OMIT if (mtnsecs == UTIME_OMIT) mtnsecs = -2; +#endif r = guestfs_utimens (g, path, atsecs, atnsecs, mtsecs, mtnsecs); if (r == -1)