aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-10-27 23:42:25 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-10-27 23:42:25 +0000
commit155a25478340968f01da4c24c144600f910c323f (patch)
tree13d20b31e817dcff5124498ca0bec2cdf9781014
parent491278531cfa3089ca16ce8a832accfd9771f1e9 (diff)
downloadbusybox-w32-155a25478340968f01da4c24c144600f910c323f.tar.gz
busybox-w32-155a25478340968f01da4c24c144600f910c323f.tar.bz2
busybox-w32-155a25478340968f01da4c24c144600f910c323f.zip
recursive_action: add depth param
chmod: match coreutils versus following links git-svn-id: svn://busybox.net/trunk/busybox@16462 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--archival/tar.c4
-rw-r--r--coreutils/chmod.c98
-rw-r--r--coreutils/chown.c8
-rw-r--r--coreutils/diff.c6
-rw-r--r--findutils/find.c6
-rw-r--r--findutils/grep.c5
-rw-r--r--include/libbb.h8
-rw-r--r--libbb/recursive_action.c40
-rw-r--r--modutils/insmod.c6
9 files changed, 123 insertions, 58 deletions
diff --git a/archival/tar.c b/archival/tar.c
index d96d20227..db812e0f4 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -301,7 +301,7 @@ static int exclude_file(const llist_t *excluded_files, const char *file)
301# endif 301# endif
302 302
303static int writeFileToTarball(const char *fileName, struct stat *statbuf, 303static int writeFileToTarball(const char *fileName, struct stat *statbuf,
304 void *userData) 304 void *userData, int depth)
305{ 305{
306 struct TarBallInfo *tbInfo = (struct TarBallInfo *) userData; 306 struct TarBallInfo *tbInfo = (struct TarBallInfo *) userData;
307 const char *header_name; 307 const char *header_name;
@@ -473,7 +473,7 @@ static int writeTarFile(const int tar_fd, const int verboseFlag,
473 /* Read the directory/files and iterate over them one at a time */ 473 /* Read the directory/files and iterate over them one at a time */
474 while (include) { 474 while (include) {
475 if (!recursive_action(include->data, TRUE, dereferenceFlag, 475 if (!recursive_action(include->data, TRUE, dereferenceFlag,
476 FALSE, writeFileToTarball, writeFileToTarball, &tbInfo)) 476 FALSE, writeFileToTarball, writeFileToTarball, &tbInfo, 0))
477 { 477 {
478 errorFlag = TRUE; 478 errorFlag = TRUE;
479 } 479 }
diff --git a/coreutils/chmod.c b/coreutils/chmod.c
index c4f8fa0b2..b601504f8 100644
--- a/coreutils/chmod.c
+++ b/coreutils/chmod.c
@@ -20,9 +20,9 @@
20#define OPT_VERBOSE (USE_DESKTOP(option_mask32 & 2) SKIP_DESKTOP(0)) 20#define OPT_VERBOSE (USE_DESKTOP(option_mask32 & 2) SKIP_DESKTOP(0))
21#define OPT_CHANGED (USE_DESKTOP(option_mask32 & 4) SKIP_DESKTOP(0)) 21#define OPT_CHANGED (USE_DESKTOP(option_mask32 & 4) SKIP_DESKTOP(0))
22#define OPT_QUIET (USE_DESKTOP(option_mask32 & 8) SKIP_DESKTOP(0)) 22#define OPT_QUIET (USE_DESKTOP(option_mask32 & 8) SKIP_DESKTOP(0))
23#define OPT_STR ("-R" USE_DESKTOP("vcf")) 23#define OPT_STR "R" USE_DESKTOP("vcf")
24 24
25/* TODO: 25/* coreutils:
26 * chmod never changes the permissions of symbolic links; the chmod 26 * chmod never changes the permissions of symbolic links; the chmod
27 * system call cannot change their permissions. This is not a problem 27 * system call cannot change their permissions. This is not a problem
28 * since the permissions of symbolic links are never used. 28 * since the permissions of symbolic links are never used.
@@ -31,19 +31,26 @@
31 * symbolic links encountered during recursive directory traversals. 31 * symbolic links encountered during recursive directory traversals.
32 */ 32 */
33 33
34static int fileAction(const char *fileName, struct stat *statbuf, void* junk) 34static int fileAction(const char *fileName, struct stat *statbuf, void* junk, int depth)
35{ 35{
36 mode_t newmode = statbuf->st_mode; 36 mode_t newmode;
37 37
38 // TODO: match GNU behavior: 38 /* match coreutils behavior */
39 // if (depth > 0 && S_ISLNK(statbuf->st_mode)) return TRUE; 39 if (depth == 0) {
40 // if (depth == 0) follow link 40 /* statbuf holds lstat result, but we need stat (follow link) */
41 if (stat(fileName, statbuf))
42 goto err;
43 } else { /* depth > 0: skip links */
44 if (S_ISLNK(statbuf->st_mode))
45 return TRUE;
46 }
47 newmode = statbuf->st_mode;
41 48
42 if (!bb_parse_mode((char *)junk, &newmode)) 49 if (!bb_parse_mode((char *)junk, &newmode))
43 bb_error_msg_and_die("invalid mode: %s", (char *)junk); 50 bb_error_msg_and_die("invalid mode: %s", (char *)junk);
44 51
45 if (chmod(fileName, statbuf->st_mode) == 0) { 52 if (chmod(fileName, newmode) == 0) {
46 if (OPT_VERBOSE /* -v verbose? or -c changed? */ 53 if (OPT_VERBOSE
47 || (OPT_CHANGED && statbuf->st_mode != newmode) 54 || (OPT_CHANGED && statbuf->st_mode != newmode)
48 ) { 55 ) {
49 printf("mode of '%s' changed to %04o (%s)\n", fileName, 56 printf("mode of '%s' changed to %04o (%s)\n", fileName,
@@ -51,7 +58,8 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
51 } 58 }
52 return TRUE; 59 return TRUE;
53 } 60 }
54 if (!OPT_QUIET) /* not silent (-f)? */ 61 err:
62 if (!OPT_QUIET)
55 bb_perror_msg("%s", fileName); 63 bb_perror_msg("%s", fileName);
56 return FALSE; 64 return FALSE;
57} 65}
@@ -62,30 +70,33 @@ int chmod_main(int argc, char **argv)
62 char *arg, **argp; 70 char *arg, **argp;
63 char *smode; 71 char *smode;
64 72
65 /* Convert first encountered -r into a-r, -w into a-w etc */ 73 /* Convert first encountered -r into ar, -w into aw etc
66 argp = argv + 1; 74 * so that getopt would not eat it */
67 while ((arg = *argp)) { 75 argp = argv;
76 while ((arg = *++argp)) {
68 /* Mode spec must be the first arg (sans -R etc) */ 77 /* Mode spec must be the first arg (sans -R etc) */
69 /* (protect against mishandling e.g. "chmod 644 -r") */ 78 /* (protect against mishandling e.g. "chmod 644 -r") */
70 if (arg[0] != '-') 79 if (arg[0] != '-') {
80 arg = NULL;
71 break; 81 break;
82 }
72 /* An option. Not a -- or valid option? */ 83 /* An option. Not a -- or valid option? */
73 if (arg[1] && !strchr(OPT_STR, arg[1])) { 84 if (arg[1] && !strchr("-"OPT_STR, arg[1])) {
74 argp[0] = xasprintf("a%s", arg); 85 arg[0] = 'a';
75 break; 86 break;
76 } 87 }
77 argp++;
78 } 88 }
79 /* "chmod -rzzz abc" will say "invalid mode: a-rzzz"!
80 * It is easily fixable, but deemed not worth the code */
81 89
90 /* Paerse options */
82 opt_complementary = "-2"; 91 opt_complementary = "-2";
83 getopt32(argc, argv, OPT_STR + 1); /* Reuse string */ 92 getopt32(argc, argv, ("-"OPT_STR) + 1); /* Reuse string */
84 argv += optind; 93 argv += optind;
85 94
86 smode = *argv++; 95 /* Restore option-like mode if needed */
96 if (arg) arg[0] = '-';
87 97
88 /* Ok, ready to do the deed now */ 98 /* Ok, ready to do the deed now */
99 smode = *argv++;
89 do { 100 do {
90 if (!recursive_action(*argv, 101 if (!recursive_action(*argv,
91 OPT_RECURSE, // recurse 102 OPT_RECURSE, // recurse
@@ -93,7 +104,8 @@ int chmod_main(int argc, char **argv)
93 FALSE, // depth first 104 FALSE, // depth first
94 fileAction, // file action 105 fileAction, // file action
95 fileAction, // dir action 106 fileAction, // dir action
96 smode) // user data 107 smode, // user data
108 0) // depth
97 ) { 109 ) {
98 retval = EXIT_FAILURE; 110 retval = EXIT_FAILURE;
99 } 111 }
@@ -101,3 +113,45 @@ int chmod_main(int argc, char **argv)
101 113
102 return retval; 114 return retval;
103} 115}
116
117/*
118Security: chmod is too important and too subtle.
119This is a test script (busybox chmod versus coreutils).
120Run it in empty dir. Probably requires bash.
121
122#!/bin/sh
123function create() {
124 rm -rf $1; mkdir $1
125 (
126 cd $1 || exit 1
127 mkdir dir
128 >up
129 >file
130 >dir/file
131 ln -s dir linkdir
132 ln -s file linkfile
133 ln -s ../up dir/up
134 )
135}
136function test() {
137 (cd test1; $t1 $1)
138 (cd test2; $t2 $1)
139 (cd test1; ls -lR) >out1
140 (cd test2; ls -lR) >out2
141 echo "chmod $1" >out.diff
142 if ! diff -u out1 out2 >>out.diff; then exit 1; fi
143 mv out.diff out1.diff
144}
145t1="/tmp/busybox chmod"
146t2="/usr/bin/chmod"
147create test1; create test2
148test "a+w file"
149test "a-w dir"
150test "a+w linkfile"
151test "a-w linkdir"
152test "-R a+w file"
153test "-R a-w dir"
154test "-R a+w linkfile"
155test "-R a-w linkdir"
156test "a-r,a+x linkfile"
157*/
diff --git a/coreutils/chown.c b/coreutils/chown.c
index bef89ce86..fddce7cf1 100644
--- a/coreutils/chown.c
+++ b/coreutils/chown.c
@@ -32,7 +32,7 @@ static int (*chown_func)(const char *, uid_t, gid_t) = chown;
32 */ 32 */
33 33
34static int fileAction(const char *fileName, struct stat *statbuf, 34static int fileAction(const char *fileName, struct stat *statbuf,
35 void ATTRIBUTE_UNUSED *junk) 35 void ATTRIBUTE_UNUSED *junk, int depth)
36{ 36{
37 // TODO: -H/-L/-P 37 // TODO: -H/-L/-P
38 // if (depth ... && S_ISLNK(statbuf->st_mode)) .... 38 // if (depth ... && S_ISLNK(statbuf->st_mode)) ....
@@ -75,7 +75,8 @@ int chown_main(int argc, char **argv)
75 *groupName++ = '\0'; 75 *groupName++ = '\0';
76 gid = get_ug_id(groupName, bb_xgetgrnam); 76 gid = get_ug_id(groupName, bb_xgetgrnam);
77 } 77 }
78 if (--groupName != *argv) uid = get_ug_id(*argv, bb_xgetpwnam); 78 if (--groupName != *argv)
79 uid = get_ug_id(*argv, bb_xgetpwnam);
79 ++argv; 80 ++argv;
80 81
81 /* Ok, ready to do the deed now */ 82 /* Ok, ready to do the deed now */
@@ -86,7 +87,8 @@ int chown_main(int argc, char **argv)
86 FALSE, // depth first 87 FALSE, // depth first
87 fileAction, // file action 88 fileAction, // file action
88 fileAction, // dir action 89 fileAction, // dir action
89 NULL) // user data 90 NULL, // user data
91 0) // depth
90 ) { 92 ) {
91 retval = EXIT_FAILURE; 93 retval = EXIT_FAILURE;
92 } 94 }
diff --git a/coreutils/diff.c b/coreutils/diff.c
index 2915d4009..f26bcca86 100644
--- a/coreutils/diff.c
+++ b/coreutils/diff.c
@@ -1030,7 +1030,7 @@ static int dir_strcmp(const void *p1, const void *p2)
1030/* This function adds a filename to dl, the directory listing. */ 1030/* This function adds a filename to dl, the directory listing. */
1031 1031
1032static int add_to_dirlist(const char *filename, 1032static int add_to_dirlist(const char *filename,
1033 struct stat ATTRIBUTE_UNUSED * sb, void *userdata) 1033 struct stat ATTRIBUTE_UNUSED * sb, void *userdata, int depth)
1034{ 1034{
1035 dl_count++; 1035 dl_count++;
1036 dl = xrealloc(dl, dl_count * sizeof(char *)); 1036 dl = xrealloc(dl, dl_count * sizeof(char *));
@@ -1067,7 +1067,7 @@ static char **get_dir(char *path)
1067 /* Now fill dl with a listing. */ 1067 /* Now fill dl with a listing. */
1068 if (cmd_flags & FLAG_r) 1068 if (cmd_flags & FLAG_r)
1069 recursive_action(path, TRUE, TRUE, FALSE, add_to_dirlist, NULL, 1069 recursive_action(path, TRUE, TRUE, FALSE, add_to_dirlist, NULL,
1070 userdata); 1070 userdata, 0);
1071 else { 1071 else {
1072 DIR *dp; 1072 DIR *dp;
1073 struct dirent *ep; 1073 struct dirent *ep;
@@ -1076,7 +1076,7 @@ static char **get_dir(char *path)
1076 while ((ep = readdir(dp))) { 1076 while ((ep = readdir(dp))) {
1077 if ((!strcmp(ep->d_name, "..")) || (!strcmp(ep->d_name, "."))) 1077 if ((!strcmp(ep->d_name, "..")) || (!strcmp(ep->d_name, ".")))
1078 continue; 1078 continue;
1079 add_to_dirlist(ep->d_name, NULL, NULL); 1079 add_to_dirlist(ep->d_name, NULL, NULL, 0);
1080 } 1080 }
1081 closedir(dp); 1081 closedir(dp);
1082 } 1082 }
diff --git a/findutils/find.c b/findutils/find.c
index 62cb5d7eb..8618f3a97 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -56,7 +56,7 @@ static int num_matches;
56static int exec_opt; 56static int exec_opt;
57#endif 57#endif
58 58
59static int fileAction(const char *fileName, struct stat *statbuf, void* junk) 59static int fileAction(const char *fileName, struct stat *statbuf, void* junk, int depth)
60{ 60{
61#ifdef CONFIG_FEATURE_FIND_XDEV 61#ifdef CONFIG_FEATURE_FIND_XDEV
62 if (S_ISDIR(statbuf->st_mode) && xdev_count) { 62 if (S_ISDIR(statbuf->st_mode) && xdev_count) {
@@ -307,12 +307,12 @@ int find_main(int argc, char **argv)
307 307
308 if (firstopt == 1) { 308 if (firstopt == 1) {
309 if (!recursive_action(".", TRUE, dereference, FALSE, fileAction, 309 if (!recursive_action(".", TRUE, dereference, FALSE, fileAction,
310 fileAction, NULL)) 310 fileAction, NULL, 0))
311 status = EXIT_FAILURE; 311 status = EXIT_FAILURE;
312 } else { 312 } else {
313 for (i = 1; i < firstopt; i++) { 313 for (i = 1; i < firstopt; i++) {
314 if (!recursive_action(argv[i], TRUE, dereference, FALSE, fileAction, 314 if (!recursive_action(argv[i], TRUE, dereference, FALSE, fileAction,
315 fileAction, NULL)) 315 fileAction, NULL, 0))
316 status = EXIT_FAILURE; 316 status = EXIT_FAILURE;
317 } 317 }
318 } 318 }
diff --git a/findutils/grep.c b/findutils/grep.c
index b76a17a41..8bb38f95c 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -290,7 +290,7 @@ static void load_regexes_from_file(llist_t *fopt)
290} 290}
291 291
292 292
293static int file_action_grep(const char *filename, struct stat *statbuf, void* matched) 293static int file_action_grep(const char *filename, struct stat *statbuf, void* matched, int depth)
294{ 294{
295 FILE *file = fopen(filename, "r"); 295 FILE *file = fopen(filename, "r");
296 if (file == NULL) { 296 if (file == NULL) {
@@ -315,7 +315,8 @@ static int grep_dir(const char *dir)
315 /* depthFirst= */ 1, 315 /* depthFirst= */ 1,
316 /* fileAction= */ file_action_grep, 316 /* fileAction= */ file_action_grep,
317 /* dirAction= */ NULL, 317 /* dirAction= */ NULL,
318 /* userData= */ &matched); 318 /* userData= */ &matched,
319 /* depth= */ 0);
319 return matched; 320 return matched;
320} 321}
321 322
diff --git a/include/libbb.h b/include/libbb.h
index 169964ba3..9f9a2b82e 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -194,10 +194,10 @@ extern int is_directory(const char *name, int followLinks, struct stat *statBuf)
194extern int remove_file(const char *path, int flags); 194extern int remove_file(const char *path, int flags);
195extern int copy_file(const char *source, const char *dest, int flags); 195extern int copy_file(const char *source, const char *dest, int flags);
196extern int recursive_action(const char *fileName, int recurse, 196extern int recursive_action(const char *fileName, int recurse,
197 int followLinks, int depthFirst, 197 int followLinks, int depthFirst,
198 int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData), 198 int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData, int depth),
199 int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData), 199 int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData, int depth),
200 void* userData); 200 void* userData, int depth);
201extern int device_open(const char *device, int mode); 201extern int device_open(const char *device, int mode);
202extern int get_console_fd(void); 202extern int get_console_fd(void);
203extern char *find_block_device(char *path); 203extern char *find_block_device(char *path);
diff --git a/libbb/recursive_action.c b/libbb/recursive_action.c
index 0d6567dda..ddaf9b896 100644
--- a/libbb/recursive_action.c
+++ b/libbb/recursive_action.c
@@ -11,7 +11,6 @@
11 11
12#undef DEBUG_RECURS_ACTION 12#undef DEBUG_RECURS_ACTION
13 13
14
15/* 14/*
16 * Walk down all the directories under the specified 15 * Walk down all the directories under the specified
17 * location, and do something (something specified 16 * location, and do something (something specified
@@ -23,16 +22,23 @@
23 * is so stinking huge. 22 * is so stinking huge.
24 */ 23 */
25 24
26static int true_action(const char *fileName, struct stat *statbuf, void* userData) 25static int true_action(const char *fileName, struct stat *statbuf, void* userData, int depth)
27{ 26{
28 return TRUE; 27 return TRUE;
29} 28}
30 29
30/*
31 * followLinks=0/1 differs mainly in handling of links to dirs.
32 * 0: lstat(statbuf). Calls fileAction on link name even if points to dir.
33 * 1: stat(statbuf). Calls dirAction and optionally recurse on link to dir.
34 */
35
31int recursive_action(const char *fileName, 36int recursive_action(const char *fileName,
32 int recurse, int followLinks, int depthFirst, 37 int recurse, int followLinks, int depthFirst,
33 int (*fileAction) (const char *fileName, struct stat * statbuf, void* userData), 38 int (*fileAction)(const char *fileName, struct stat *statbuf, void* userData, int depth),
34 int (*dirAction) (const char *fileName, struct stat * statbuf, void* userData), 39 int (*dirAction)(const char *fileName, struct stat *statbuf, void* userData, int depth),
35 void* userData) 40 void* userData,
41 int depth)
36{ 42{
37 struct stat statbuf; 43 struct stat statbuf;
38 int status; 44 int status;
@@ -53,21 +59,23 @@ int recursive_action(const char *fileName,
53 return FALSE; 59 return FALSE;
54 } 60 }
55 61
56 if (!followLinks && (S_ISLNK(statbuf.st_mode))) { 62 /* If S_ISLNK(m), then we know that !S_ISDIR(m).
57 return fileAction(fileName, &statbuf, userData); 63 * Then we can skip checking first part: if it is true, then
64 * (!dir) is also true! */
65 if ( /* (!followLinks && S_ISLNK(statbuf.st_mode)) || */
66 !S_ISDIR(statbuf.st_mode)
67 ) {
68 return fileAction(fileName, &statbuf, userData, depth);
58 } 69 }
59 70
71 /* It's a directory (or a link to one, and followLinks is set) */
72
60 if (!recurse) { 73 if (!recurse) {
61 if (S_ISDIR(statbuf.st_mode)) { 74 return dirAction(fileName, &statbuf, userData, depth);
62 return dirAction(fileName, &statbuf, userData);
63 }
64 } 75 }
65 76
66 if (!S_ISDIR(statbuf.st_mode))
67 return fileAction(fileName, &statbuf, userData);
68
69 if (!depthFirst) { 77 if (!depthFirst) {
70 status = dirAction(fileName, &statbuf, userData); 78 status = dirAction(fileName, &statbuf, userData, depth);
71 if (!status) { 79 if (!status) {
72 bb_perror_msg("%s", fileName); 80 bb_perror_msg("%s", fileName);
73 return FALSE; 81 return FALSE;
@@ -88,14 +96,14 @@ int recursive_action(const char *fileName,
88 if (nextFile == NULL) 96 if (nextFile == NULL)
89 continue; 97 continue;
90 if (!recursive_action(nextFile, TRUE, followLinks, depthFirst, 98 if (!recursive_action(nextFile, TRUE, followLinks, depthFirst,
91 fileAction, dirAction, userData)) { 99 fileAction, dirAction, userData, depth+1)) {
92 status = FALSE; 100 status = FALSE;
93 } 101 }
94 free(nextFile); 102 free(nextFile);
95 } 103 }
96 closedir(dir); 104 closedir(dir);
97 if (depthFirst) { 105 if (depthFirst) {
98 if (!dirAction(fileName, &statbuf, userData)) { 106 if (!dirAction(fileName, &statbuf, userData, depth)) {
99 bb_perror_msg("%s", fileName); 107 bb_perror_msg("%s", fileName);
100 return FALSE; 108 return FALSE;
101 } 109 }
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 00e25f5e3..49b823d0e 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -801,7 +801,7 @@ static char *m_fullName;
801 801
802 802
803static int check_module_name_match(const char *filename, struct stat *statbuf, 803static int check_module_name_match(const char *filename, struct stat *statbuf,
804 void *userdata) 804 void *userdata, int depth)
805{ 805{
806 char *fullname = (char *) userdata; 806 char *fullname = (char *) userdata;
807 807
@@ -4048,7 +4048,7 @@ int insmod_main( int argc, char **argv)
4048 else 4048 else
4049 module_dir = real_module_dir; 4049 module_dir = real_module_dir;
4050 recursive_action(module_dir, TRUE, FALSE, FALSE, 4050 recursive_action(module_dir, TRUE, FALSE, FALSE,
4051 check_module_name_match, 0, m_fullName); 4051 check_module_name_match, 0, m_fullName, 0);
4052 free(tmdn); 4052 free(tmdn);
4053 } 4053 }
4054 4054
@@ -4063,7 +4063,7 @@ int insmod_main( int argc, char **argv)
4063 /* No module found under /lib/modules/`uname -r`, this 4063 /* No module found under /lib/modules/`uname -r`, this
4064 * time cast the net a bit wider. Search /lib/modules/ */ 4064 * time cast the net a bit wider. Search /lib/modules/ */
4065 if (!recursive_action(module_dir, TRUE, FALSE, FALSE, 4065 if (!recursive_action(module_dir, TRUE, FALSE, FALSE,
4066 check_module_name_match, 0, m_fullName) 4066 check_module_name_match, 0, m_fullName, 0)
4067 ) { 4067 ) {
4068 if (m_filename == 0 4068 if (m_filename == 0
4069 || ((fp = fopen(m_filename, "r")) == NULL) 4069 || ((fp = fopen(m_filename, "r")) == NULL)