Ignore:
Timestamp:
Nov 18, 2016, 5:31:42 PM (7 years ago)
Author:
Bruno Cornec
Message:

Add function mr_getcwd and use it to allow use o dynamically allocated memory
instead of getcwd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mondo/src/mondorestore/mondo-rstr-tools.c

    r3610 r3613  
    88#include "mr_mem.h"
    99#include "mr_str.h"
     10#include "mr_file.h"
    1011#include "../common/mondostructures.h"
    1112#include "../common/libmondo.h"
     
    127128FILE *fout;
    128129char *incoming = NULL;
     130char *p = NULL;
    129131char *question = NULL;
    130132
     
    10121014
    10131015char *command = NULL;
    1014 char *tmp;
     1016char *old_pwd = NULL;
    10151017char *q;
    10161018int res = 0;
     
    10191021
    10201022assert(bkpinfo != NULL);
    1021 malloc_string(tmp);
    10221023
    10231024/* If those files already exist, do not overwrite them later on */
     
    10351036        "Filelist and biggielist already recovered from media. Yay!");
    10361037} else {
    1037     if (getcwd(tmp, MAX_STR_LEN) == NULL) {
    1038         // FIXME
    1039     }
     1038    old_pwd = mr_getcwd();
    10401039    if (chdir(bkpinfo->tmpdir)) {
    10411040        // FIXME
     
    11131112    }
    11141113
    1115     if (chdir(tmp)) {
     1114    if (chdir(old_pwd)) {
    11161115        // FIXME
    11171116    }
     1117    mr_free(old_pwd);
    11181118
    11191119    if (!does_file_exist(g_biggielist_txt)) {
     
    11921192    }
    11931193
    1194     paranoid_free(tmp);
    11951194    return (filelist);
    11961195}
Note: See TracChangeset for help on using the changeset viewer.