diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2012-09-18 00:24:49 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruen@linbit.com> | 2012-09-18 00:48:01 +0200 |
commit | 0f22a35cecdaf83b8fca3cdfb5c45feb6f5e292c (patch) | |
tree | 2b1271e4b954bd508d14e460b8f4db48ba83f53f | |
parent | 4c7c0976ac8743d0b934b07f59ba9448a76dbac1 (diff) | |
download | patch-0f22a35cecdaf83b8fca3cdfb5c45feb6f5e292c.tar.gz |
Rename get_input_file() parameter to clarify code
* src/inp.c (get_input_file): Rename mode parameter to file_type, it's all we
care about here.
-rw-r--r-- | src/inp.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -130,7 +130,7 @@ too_many_lines (char const *filename) bool -get_input_file (char const *filename, char const *outname, mode_t mode) +get_input_file (char const *filename, char const *outname, mode_t file_type) { bool elsewhere = strcmp (filename, outname) != 0; char const *cs; @@ -141,7 +141,7 @@ get_input_file (char const *filename, char const *outname, mode_t mode) inerrno = lstat (filename, &instat) == 0 ? 0 : errno; /* Perhaps look for RCS or SCCS versions. */ - if (S_ISREG (mode) + if (S_ISREG (file_type) && patch_get && invc != 0 && (inerrno @@ -195,12 +195,12 @@ get_input_file (char const *filename, char const *outname, mode_t mode) instat.st_mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH; instat.st_size = 0; } - else if (! ((S_ISREG (mode) || S_ISLNK (mode)) - && (mode & S_IFMT) == (instat.st_mode & S_IFMT))) + else if (! ((S_ISREG (file_type) || S_ISLNK (file_type)) + && (file_type & S_IFMT) == (instat.st_mode & S_IFMT))) { say ("File %s is not a %s -- refusing to patch\n", quotearg (filename), - S_ISLNK (mode) ? "symbolic link" : "regular file"); + S_ISLNK (file_type) ? "symbolic link" : "regular file"); return false; } return true; |