IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 24, 2006, 2:42:35 PM (20 years ago)
Author:
eugene
Message:

moved check_permissions to libohana, added buttons to Kii

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libohana/src/findexec.c

    r5451 r6674  
    11# include <ohana.h>
    22
    3 int _check_permissions (char *filename) {
     3int check_file_exec (char *filename) {
    44 
    55  struct stat filestat;
     
    4848    if (VERBOSE) fprintf (stderr, "directory %s does not exist, creating...\n", path);
    4949    cmode = S_IRWXU | S_IRWXG | S_IRWXO;
    50     status = mkdir (path, cmode);
     50    status = mkdirhier (path, cmode);
    5151    if (status == -1) {
    5252      if (VERBOSE) fprintf (stderr, "can't create %s\n", path);
     
    212212  /* if given an absolute or relative path, use it */
    213213  if (strchr (argv[0], '/') != (char *) NULL) {
    214     status = _check_permissions (argv[0]);
     214    status = check_file_exec (argv[0]);
    215215    if (status) {
    216216      if (realpath (argv[0], path) == (char *) NULL) return ((char *) NULL);
     
    245245      }
    246246      sprintf (name, "%s/%s", path, argv[0]);
    247       status = _check_permissions (name);
     247      status = check_file_exec (name);
    248248
    249249      if (status) {
     
    257257}
    258258
    259 int mkdirhier (char *path) {
     259/* make directory hierarchy, 0: success, -1: failure (just like mkdir) */
     260int mkdirhier (char *path, int mode) {
    260261
    261262  char *tpath;
    262263
    263   if (mkdir (path, 0777)) {
     264  /* force addition of user exec/read/write */
     265  mode |= S_IRWXU;
     266  if (mkdir (path, mode)) {
    264267    if (errno == ENOENT) {
    265268      tpath = pathname (path);
    266       if (!mkdirhier (tpath)) {
    267         if (mkdir (path, 0777)) {
     269      if (!mkdirhier (tpath, mode)) {
     270        if (mkdir (path, mode)) {
    268271          return (-1);
    269272        } else {
Note: See TracChangeset for help on using the changeset viewer.