Changeset 1100 in MondoRescue


Ignore:
Timestamp:
Feb 5, 2007, 5:00:16 PM (17 years ago)
Author:
Bruno Cornec
Message:

Addition of mr_mkdir in library and usage in main for MONDO_CACHE creation

Location:
branches/stable/mondo/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/common/libmondo-files.c

    r1098 r1100  
    12211221    }
    12221222
    1223     mkdir(MONDO_CACHE,0x755);
    12241223    fd1 = mr_fopen(MONDORESTORECFG, "a");
    12251224
  • branches/stable/mondo/src/include/mr_file.h

    r1092 r1100  
    2020extern FILE *mr_fprintf(FILE *stream, const char *fmt, ...);
    2121extern void mr_fclose(FILE *fd);
     22extern void mr_mkdir(const char *pathname, mode_t mode);
    2223
    2324#endif                          /* MR_FILE_H */
  • branches/stable/mondo/src/lib/mr_file.c

    r1091 r1100  
    1111
    1212#include <stdio.h>
     13#include <sys/types.h>
     14#include <sys/stat.h>
     15
    1316#include "mr_err.h"
    1417#include "mr_msg.h"
     
    5053    fd = NULL;
    5154}
     55
     56void mr_mkdir(const char *pathname, mode_t mode) {
     57
     58    if (mkdir(pathname,mode) != 0) {
     59        mr_msg("Unable to create directory %s",pathname);
     60        mr_exit(-1,"Exiting");
     61    }
     62}
  • branches/stable/mondo/src/mondoarchive/main.c

    r1087 r1100  
    1111/************************* #include statements *************************/
    1212#include <pthread.h>
    13 //#include <config.h>
    14 //#include "../../config.h"
    1513#include <stdio.h>
    1614#include <stdlib.h>
     15#include <sys/types.h>
     16#include <sys/stat.h>
     17#include <unistd.h>
     18
    1719#include "my-stuff.h"
    1820#include "../common/mondostructures.h"
     
    152154{
    153155    struct s_bkpinfo *bkpinfo;
     156    struct stat stbuf;
    154157    char *tmp;
    155158    int res, retval;
     
    202205    setenv("ARCH", tmp, 1);
    203206
    204     /* Add MONDO_SHARE environment variable for mindi */
     207    /* Add MONDO_SHARE + others environment variable for mindi */
    205208    setenv_mondo_share();
     209
     210    if (stat(MONDO_CACHE, &stbuf) != 0) {
     211        mr_mkdir(MONDO_CACHE,0x755);
     212    }
    206213
    207214    /* Configure the bkpinfo structure, global file paths, etc. */
Note: See TracChangeset for help on using the changeset viewer.