Changeset 6674 for trunk/Ohana/src/libohana/src/findexec.c
- Timestamp:
- Mar 24, 2006, 2:42:35 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libohana/src/findexec.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libohana/src/findexec.c
r5451 r6674 1 1 # include <ohana.h> 2 2 3 int _check_permissions(char *filename) {3 int check_file_exec (char *filename) { 4 4 5 5 struct stat filestat; … … 48 48 if (VERBOSE) fprintf (stderr, "directory %s does not exist, creating...\n", path); 49 49 cmode = S_IRWXU | S_IRWXG | S_IRWXO; 50 status = mkdir (path, cmode);50 status = mkdirhier (path, cmode); 51 51 if (status == -1) { 52 52 if (VERBOSE) fprintf (stderr, "can't create %s\n", path); … … 212 212 /* if given an absolute or relative path, use it */ 213 213 if (strchr (argv[0], '/') != (char *) NULL) { 214 status = _check_permissions(argv[0]);214 status = check_file_exec (argv[0]); 215 215 if (status) { 216 216 if (realpath (argv[0], path) == (char *) NULL) return ((char *) NULL); … … 245 245 } 246 246 sprintf (name, "%s/%s", path, argv[0]); 247 status = _check_permissions(name);247 status = check_file_exec (name); 248 248 249 249 if (status) { … … 257 257 } 258 258 259 int mkdirhier (char *path) { 259 /* make directory hierarchy, 0: success, -1: failure (just like mkdir) */ 260 int mkdirhier (char *path, int mode) { 260 261 261 262 char *tpath; 262 263 263 if (mkdir (path, 0777)) { 264 /* force addition of user exec/read/write */ 265 mode |= S_IRWXU; 266 if (mkdir (path, mode)) { 264 267 if (errno == ENOENT) { 265 268 tpath = pathname (path); 266 if (!mkdirhier (tpath )) {267 if (mkdir (path, 0777)) {269 if (!mkdirhier (tpath, mode)) { 270 if (mkdir (path, mode)) { 268 271 return (-1); 269 272 } else {
Note:
See TracChangeset
for help on using the changeset viewer.
