summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--pgfuse.c24
2 files changed, 25 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 594abbf..1a594e6 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,9 @@ test: pgfuse testfsync
-ls -al mnt/dir/dir2
# expect success on rmdir
-rmdir mnt/dir/dir3
+ # expect success on chmod
+ -chmod 777 mnt/dir/dir2/bfile
+ -ls -al mnt/dir/dir2/bfile
# expect success on file removal
-rm mnt/dir/dir2/bfile
# expect success on rename
diff --git a/pgfuse.c b/pgfuse.c
index 0f7566f..b11b4be 100644
--- a/pgfuse.c
+++ b/pgfuse.c
@@ -403,7 +403,8 @@ static int pgfuse_mkdir( const char *path, mode_t mode )
PgMeta meta;
if( data->verbose ) {
- syslog( LOG_INFO, "Mkdir '%s' in mode '%o' on '%s'", path, (unsigned int)mode, data->mountpoint );
+ syslog( LOG_INFO, "Mkdir '%s' in mode '%o' on '%s'",
+ path, (unsigned int)mode, data->mountpoint );
}
if( data->read_only ) {
@@ -797,7 +798,26 @@ static int pgfuse_statfs( const char *path, struct statvfs *buf )
static int pgfuse_chmod( const char *path, mode_t mode )
{
- return -EPERM;
+ PgFuseData *data = (PgFuseData *)fuse_get_context( )->private_data;
+ int id;
+ PgMeta meta;
+ int res;
+
+ if( data->verbose ) {
+ syslog( LOG_INFO, "Chmod on '%s' to mode '%o' on '%s'",
+ path, (unsigned int)mode, data->mountpoint );
+ }
+
+ id = psql_get_meta( data->conn, path, &meta );
+ if( id < 0 ) {
+ return id;
+ }
+
+ meta.mode = mode;
+
+ res = psql_write_meta( data->conn, id, path, meta );
+
+ return res;
}
static struct fuse_operations pgfuse_oper = {