patch 7.4.1516
Problem:    Cannot change file permissions.
Solution:   Add setfperm().
diff --git a/src/eval.c b/src/eval.c
index 70a1daa..1422dc2 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -735,6 +735,7 @@
 static void f_setbufvar(typval_T *argvars, typval_T *rettv);
 static void f_setcharsearch(typval_T *argvars, typval_T *rettv);
 static void f_setcmdpos(typval_T *argvars, typval_T *rettv);
+static void f_setfperm(typval_T *argvars, typval_T *rettv);
 static void f_setline(typval_T *argvars, typval_T *rettv);
 static void f_setloclist(typval_T *argvars, typval_T *rettv);
 static void f_setmatches(typval_T *argvars, typval_T *rettv);
@@ -8446,6 +8447,7 @@
     {"setbufvar",	3, 3, f_setbufvar},
     {"setcharsearch",	1, 1, f_setcharsearch},
     {"setcmdpos",	1, 1, f_setcmdpos},
+    {"setfperm",	2, 2, f_setfperm},
     {"setline",		2, 2, f_setline},
     {"setloclist",	2, 3, f_setloclist},
     {"setmatches",	1, 1, f_setmatches},
@@ -18422,6 +18424,42 @@
 }
 
 /*
+ * "setfperm({fname}, {mode})" function
+ */
+    static void
+f_setfperm(typval_T *argvars, typval_T *rettv)
+{
+    char_u	*fname;
+    char_u	modebuf[NUMBUFLEN];
+    char_u	*mode_str;
+    int		i;
+    int		mask;
+    int		mode = 0;
+
+    rettv->vval.v_number = 0;
+    fname = get_tv_string_chk(&argvars[0]);
+    if (fname == NULL)
+	return;
+    mode_str = get_tv_string_buf_chk(&argvars[1], modebuf);
+    if (mode_str == NULL)
+	return;
+    if (STRLEN(mode_str) != 9)
+    {
+	EMSG2(_(e_invarg2), mode_str);
+	return;
+    }
+
+    mask = 1;
+    for (i = 8; i >= 0; --i)
+    {
+	if (mode_str[i] != '-')
+	    mode |= mask;
+	mask = mask << 1;
+    }
+    rettv->vval.v_number = mch_setperm(fname, mode) == OK;
+}
+
+/*
  * "setline()" function
  */
     static void
diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim
index d7718ff..857fe9a 100644
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -5,6 +5,7 @@
 source test_cursor_func.vim
 source test_delete.vim
 source test_expand.vim
+source test_file_perm.vim
 source test_glob2regpat.vim
 source test_join.vim
 source test_lispwords.vim
diff --git a/src/testdir/test_file_perm.vim b/src/testdir/test_file_perm.vim
new file mode 100644
index 0000000..44778ee
--- /dev/null
+++ b/src/testdir/test_file_perm.vim
@@ -0,0 +1,20 @@
+" Test getting and setting file permissions.
+
+func Test_file_perm()
+  call assert_equal('', getfperm('Xtest'))
+  call assert_equal(0, setfperm('Xtest', 'r--------'))
+
+  call writefile(['one'], 'Xtest')
+  call assert_true(len(getfperm('Xtest')) == 9)
+
+  call assert_equal(1, setfperm('Xtest', 'rwx------'))
+  call assert_equal('rwx------', getfperm('Xtest'))
+
+  call assert_equal(1, setfperm('Xtest', 'r--r--r--'))
+  call assert_equal('r--r--r--', getfperm('Xtest'))
+
+  call assert_fails("setfperm('Xtest', '---')")
+
+  call assert_equal(1, setfperm('Xtest', 'rwx------'))
+  call delete('Xtest')
+endfunc
diff --git a/src/version.c b/src/version.c
index 8b5385e..f39635e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -744,6 +744,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1516,
+/**/
     1515,
 /**/
     1514,