Changeset 468 in MondoRescue


Ignore:
Timestamp:
Apr 8, 2006, 11:04:34 PM (18 years ago)
Author:
bcornec
Message:

Now fixes -E and -I.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0.7/mondo/mondo/mondoarchive/mondo-cli.c

    r395 r468  
    356356    /*@ buffers ** */
    357357    char *tmp;
     358    char *tmp1;
    358359    char *psz;
    359360
     
    442443            strcat(bkpinfo->include_paths, " ");
    443444        }
    444         if (stat(flag_val['I'], &buf) != 0) {
    445             log_msg(1, "ERROR ! %s doesn't exist", flag_val['I']);
    446             fatal_error("ERROR ! You specified a directory to include which doesn't exist");
    447         }
     445        asprintf(&tmp1, flag_val['I']);
     446        char *p = tmp1;
     447        char *q = tmp1;
     448
     449        /* Cut the flag_val['I'] in parts containing all paths to test them */
     450        while (p != NULL) {
     451            q = strchr(p, ' ');
     452            if (q != NULL) {
     453                *q = '\0';
     454                p = q+1 ;
     455                if (stat(p, &buf) != 0) {
     456                    log_msg(1, "ERROR ! %s doesn't exist", p);
     457                    fatal_error("ERROR ! You specified a directory to include which doesn't exist");
     458                }
     459            } else {
     460                if (stat(p, &buf) != 0) {
     461                    log_msg(1, "ERROR ! %s doesn't exist", p);
     462                    fatal_error("ERROR ! You specified a directory to include which doesn't exist");
     463                }
     464                p = NULL;
     465            }
     466        }
     467        paranoid_free(tmp1);
     468
    448469        strncpy(bkpinfo->include_paths + strlen(bkpinfo->include_paths),
    449470                flag_val['I'],
     
    659680            strcat(bkpinfo->exclude_paths, " ");
    660681        }
    661         if (stat(flag_val['E'], &buf) != 0) {
    662             log_msg(1, "WARNING ! %s doesn't exist", flag_val['E']);
    663         }
     682        asprintf(&tmp1, flag_val['E']);
     683        char *p = tmp1;
     684        char *q = tmp1;
     685
     686        /* Cut the flag_val['E'] in parts containing all paths to test them */
     687        while (p != NULL) {
     688            q = strchr(p, ' ');
     689            if (q != NULL) {
     690                *q = '\0';
     691                p = q+1 ;
     692                if (stat(p, &buf) != 0) {
     693                    log_msg(1, "WARNING ! %s doesn't exist", p);
     694                }
     695            } else {
     696                if (stat(p, &buf) != 0) {
     697                    log_msg(1, "WARNING ! %s doesn't exist", p);
     698                }
     699                p = NULL;
     700            }
     701        }
     702        paranoid_free(tmp1);
     703
    664704        strncpy(bkpinfo->exclude_paths + strlen(bkpinfo->exclude_paths),
    665705                flag_val['E'],
Note: See TracChangeset for help on using the changeset viewer.