From d1d6748ef6339e8288666419ba008b3569532103 Mon Sep 17 00:00:00 2001
From: Eli Collins <eli@cloudera.com>
Date: Tue, 12 Jan 2010 20:56:24 -0800
Subject: [PATCH] HDFS-860: fuse-dfs truncate behavior causes issues with scp

---
 src/contrib/fuse-dfs/src/fuse_impls_truncate.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/contrib/fuse-dfs/src/fuse_impls_truncate.c b/src/contrib/fuse-dfs/src/fuse_impls_truncate.c
index 7132b8a..b93cb45 100644
--- a/src/contrib/fuse-dfs/src/fuse_impls_truncate.c
+++ b/src/contrib/fuse-dfs/src/fuse_impls_truncate.c
@@ -29,8 +29,11 @@
 int dfs_truncate(const char *path, off_t size)
 {
   TRACE1("truncate", path)
+  // Silently supress truncates with non-zero sizes, this allows
+  // fuse-dfs to work with some programs like scp, which truncate
+  // the files to the number of bytes they have written.
   if (size != 0) {
-    return -ENOTSUP;
+    return 0;
   }
 
   dfs_context *dfs = (dfs_context*)fuse_get_context()->private_data;
-- 
1.6.0.4

