Ignore:
Timestamp:
Sep 20, 2013, 2:29:57 PM (11 years ago)
Author:
Bruno Cornec
Message:

Simplify the interface of mr_getline and mr_asprintf. With 3.1 compatibility now will allow backports from this branch into 3.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mondo/src/common/libmondo-devices.c

    r3171 r3185  
    131131
    132132    malloc_string(comment);
    133     mr_asprintf(&tmp, "%s", where_is_root_mounted());
     133    mr_asprintf(tmp, "%s", where_is_root_mounted());
    134134    sprintf(comment, "root is mounted at %s\n", tmp);
    135135    log_msg(0, comment);
     
    555555    run_program_and_log_output("insmod ide-scsi", -1);
    556556    if (find_home_of_exe("cdrecord")) {
    557         mr_asprintf(&cdr_exe, "cdrecord");
     557        mr_asprintf(cdr_exe, "cdrecord");
    558558    } else {
    559         mr_asprintf(&cdr_exe, "dvdrecord");
     559        mr_asprintf(cdr_exe, "dvdrecord");
    560560    }
    561561    if (find_home_of_exe(cdr_exe)) {
     
    563563                "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -E '[D|C][V|D]' | cut -d' ' -f2 | head -n1",
    564564                cdr_exe);
    565         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     565        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    566566    }
    567567    if ((tmp == NULL) || (strlen(tmp) < 2)) {
     
    653653
    654654    if (find_home_of_exe("cdrecord")) {
    655         mr_asprintf(&cdr_exe, "cdrecord");
     655        mr_asprintf(cdr_exe, "cdrecord");
    656656    } else {
    657         mr_asprintf(&cdr_exe, "dvdrecord");
     657        mr_asprintf(cdr_exe, "dvdrecord");
    658658    }
    659659    tmp[0] = '\0';
     
    876876            cdr_exe, g_cdrw_drive_is_here);
    877877    log_msg(1, "command=%s", command);
    878     mr_asprintf(&tmp1, "%s", call_program_and_get_last_line_of_output(command));
     878    mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output(command));
    879879    if (strlen(tmp1) > 0) {
    880880        strcpy(output, tmp1);
     
    11341134        log_msg(1, "%s needs to have a '/' prefixed - I'll do it",
    11351135                device_raw);
    1136         mr_asprintf(&tmp, "/%s", device_raw);
     1136        mr_asprintf(tmp, "/%s", device_raw);
    11371137    } else {
    1138         mr_asprintf(&tmp, "%s", device_raw);
     1138        mr_asprintf(tmp, "%s", device_raw);
    11391139    }
    11401140    log_msg(1, "Is %s mounted?", tmp);
     
    11451145        return(FALSE);
    11461146    }
    1147     mr_asprintf(&device_with_tab, "%s\t", tmp);
    1148     mr_asprintf(&device_with_space, "%s ", tmp);
     1147    mr_asprintf(device_with_tab, "%s\t", tmp);
     1148    mr_asprintf(device_with_space, "%s ", tmp);
    11491149    mr_free(tmp);
    11501150
     
    11651165    mr_free(device_with_tab);
    11661166    paranoid_pclose(fin);
    1167     mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
     1167    mr_asprintf(tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
    11681168    mr_free(device_with_space);
    11691169    log_msg(4, "tmp (command) = '%s'", tmp);
     
    13091309    }
    13101310#ifndef __FreeBSD__
    1311     mr_asprintf(&options, "ro");
     1311    mr_asprintf(options, "ro");
    13121312#endif
    13131313
     
    13151315
    13161316#ifdef __FreeBSD__
    1317         mr_asprintf(&dev, "%s", make_vn(device));
     1317        mr_asprintf(dev, "%s", make_vn(device));
    13181318        if (!dev) {
    1319             mr_asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", device);
     1319            mr_asprintf(command, "Unable to mount ISO (make_vn(%s) failed)", device);
    13201320            fatal_error(command);
    13211321        }
     
    13321332
    13331333#ifdef __FreeBSD__
    1334     mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
     1334    mr_asprintf(command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    13351335
    13361336#else
    1337     mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
     1337    mr_asprintf(command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
    13381338    paranoid_free(options);
    13391339#endif
     
    14071407    } else if (bkpinfo->backup_media_type == iso) {
    14081408        if (bkpinfo->subdir) {
    1409             mr_asprintf(&mountdir, "%s/%s", bkpinfo->isodir, bkpinfo->subdir);
     1409            mr_asprintf(mountdir, "%s/%s", bkpinfo->isodir, bkpinfo->subdir);
    14101410        } else {
    1411             mr_asprintf(&mountdir, "%s", bkpinfo->isodir);
     1411            mr_asprintf(mountdir, "%s", bkpinfo->isodir);
    14121412        }
    14131413#ifdef __FreeBSD__
     
    16731673    ********/
    16741674    /* Get the number of mounted file systems ((those that start with "/dev/" */
    1675     mr_asprintf(&command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");
     1675    mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");
    16761676    log_msg(5, "Running: %s", command);
    1677     mr_asprintf(&mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
     1677    mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
    16781678    paranoid_free(command);
    16791679
     
    16831683
    16841684    for (i=mount_cnt; i > 0; i--) {
    1685         mr_asprintf(&command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);
     1685        mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);
    16861686        log_msg(5, "Running: %s", command);
    1687         mr_asprintf(&mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
     1687        mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
    16881688        paranoid_free(command);
    16891689
     
    17701770    log_msg(4, "  %s looks like a device special file", dsf);
    17711771    /* Verify that the dsf exists */
    1772     mr_asprintf(&command, "ls -al %s 2>/dev/null | wc -l", dsf);
     1772    mr_asprintf(command, "ls -al %s 2>/dev/null | wc -l", dsf);
    17731773    log_msg(5, "  Executing: %s", command);
    1774     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1774    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    17751775    paranoid_free(command);
    17761776
     
    17961796    * Either way, it's an error.
    17971797    ********/
    1798     mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
     1798    mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
    17991799    log_msg(5, "Executing: %s", command);
    1800     mr_asprintf(&partition_list, "%s", call_program_and_get_last_line_of_output(command));
     1800    mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command));
    18011801    paranoid_free(command);
    18021802    log_msg(4, "Partition list for %s: %s", dsf, partition_list);
     
    18161816            mr_free(token);
    18171817        }
    1818         mr_asprintf(&ndsf, "%s", dsf);
     1818        mr_asprintf(ndsf, "%s", dsf);
    18191819    }
    18201820    mr_free(partition_list);
     
    18621862        log_msg(4, "Processing partition: %s", partitions[i]);
    18631863        /* See if it's swap. If it is, ignore it. */
    1864         mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
     1864        mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
    18651865          ndsf, partitions[i]);
    18661866        log_msg(5, "  Running: %s", command);
    1867         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1867        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    18681868        paranoid_free(command);
    18691869        log_msg(5, "  Return value: %s", tmp);
     
    18751875        }
    18761876        /* It's not swap. See if we can find the mount point from the mount command. */
    1877         mr_asprintf(&command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);
    1878         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1877        mr_asprintf(command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);
     1878        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    18791879        paranoid_free(command);
    18801880        if (strlen(tmp)) {
     
    18931893        log_msg(4, "  It's not mounted. Checking to see if it's LVM...");
    18941894        /* Check for LVM */
    1895         mr_asprintf(&command, "pvdisplay -c %s 2> /dev/null", partitions[i]);
     1895        mr_asprintf(command, "pvdisplay -c %s 2> /dev/null", partitions[i]);
    18961896        log_msg(5, "  Running: %s", command);
    1897         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1897        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    18981898        paranoid_free(command);
    18991899        if (strlen(tmp)) {
    19001900            log_msg(4, "Found an LVM partition at %s. Find the VG it's in...", partitions[i]);
    19011901            /* It's LVM: Find the VG it's in */
    1902             mr_asprintf(&command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);
     1902            mr_asprintf(command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);
    19031903            log_msg(5, "  Running: %s", command);
    19041904            strcpy(VG, call_program_and_get_last_line_of_output(command));
     
    19081908                /* Found the Volume Group. Now find all of the VG's mount points */
    19091909                log_msg(4, "  Found the Volume Group. Now find all of the VG's mount points");
    1910                 mr_asprintf(&command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);
     1910                mr_asprintf(command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);
    19111911                log_msg(5, "  Running: %s", command);
    1912                 mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     1912                mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    19131913                paranoid_free(command);
    19141914                log_msg(4, "  VG %s mount_list: %s", VG, mount_list);
     
    19311931                paranoid_free(mount_list);
    19321932
    1933                 mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     1933                mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    19341934                log_msg (5, "Running: %s", command);
    1935                 mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     1935                mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    19361936                paranoid_free(command);
    19371937                log_msg(4, "  Software raid device list: %s", mount_list);
    19381938                lastpos = 0;
    19391939                while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) {
    1940                     mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);
     1940                    mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);
    19411941                    log_msg (5, "Running: %s", command);
    19421942                    paranoid_free(tmp);
    1943                     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1943                    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    19441944                    paranoid_free(command);
    19451945                    log_msg(4, "Number of Software raid device: %s", tmp);
     
    19721972         ********/
    19731973        log_msg (5, "It's not swap, mounted, or LVM. See if it's used in a software raid device.");
    1974         mr_asprintf(&command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);
     1974        mr_asprintf(command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);
    19751975        log_msg(4, "  Running: %s", command);
    1976         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1976        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    19771977        paranoid_free(command);
    19781978        if (!strlen(tmp)) {
     
    19831983        log_msg (5, "  UUID: %s", tmp);
    19841984        /* Get the Software raid device list */
    1985         mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     1985        mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    19861986        log_msg (5, "  Running: %s", command);
    1987         mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     1987        mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    19881988        paranoid_free(command);
    19891989        log_msg(4, "  Software raid device list: %s", mount_list);
     
    19911991        lastpos = 0;
    19921992        while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) {
    1993             mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp);
     1993            mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp);
    19941994            log_msg(4, "  Running: %s", command);
    19951995            paranoid_free(tmp);
    1996             mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1996            mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    19971997            paranoid_free(command);
    19981998            if (!atoi(tmp)) {
     
    20882088                    mr_strcat(bkpinfo->exclude_paths,"|%s",mounted_on_dsf);
    20892089                } else {
    2090                     mr_asprintf(&(bkpinfo->exclude_paths),"%s",mounted_on_dsf);
     2090                    mr_asprintf(bkpinfo->exclude_paths,"%s",mounted_on_dsf);
    20912091                }
    20922092                if (bkpinfo->exclude_devs) {
    20932093                    mr_strcat(bkpinfo->exclude_devs,"|%s",token);
    20942094                } else {
    2095                     mr_asprintf(&(bkpinfo->exclude_devs),"%s",token);
     2095                    mr_asprintf(bkpinfo->exclude_devs,"%s",token);
    20962096                }
    20972097            }
     
    21072107                    mr_strcat(bkpinfo->exclude_paths, "|%s",not_mounted_on_dsf);
    21082108                } else {
    2109                     mr_asprintf(&(bkpinfo->exclude_paths),"%s",not_mounted_on_dsf);
     2109                    mr_asprintf(bkpinfo->exclude_paths,"%s",not_mounted_on_dsf);
    21102110                }
    21112111            }
     
    21192119    case -1:
    21202120        /*  Adds a | to ensure correct detection even at both ends */
    2121         mr_asprintf(&tmp1,"|%s",token);
    2122         mr_asprintf(&tmp2,"|%s|",token);
     2121        mr_asprintf(tmp1,"|%s",token);
     2122        mr_asprintf(tmp2,"|%s|",token);
    21232123        if (mode == 'E') {
    21242124            /*  Add the token if not already in the list */
    2125             mr_asprintf(&tmp,"|%s|",bkpinfo->exclude_paths);
     2125            mr_asprintf(tmp,"|%s|",bkpinfo->exclude_paths);
    21262126            if (strstr(tmp,tmp2) == NULL) {
    21272127                if (bkpinfo->exclude_paths) {
     
    21342134        } else {
    21352135            /*  Add the token if not already in the list */
    2136             mr_asprintf(&tmp,"|%s|",bkpinfo->include_paths);
     2136            mr_asprintf(tmp,"|%s|",bkpinfo->include_paths);
    21372137            if (strstr(tmp,tmp2) == NULL) {
    21382138                strcat(bkpinfo->include_paths,tmp1);
     
    22192219         */
    22202220#ifdef __FreeBSD__
    2221         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,vmhgfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));
     2221        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,vmhgfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));
    22222222#else
    2223         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x vmhgfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));
     2223        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x vmhgfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));
    22242224#endif
    22252225
    22262226        if (tmp[0] != '/') {
    2227             mr_asprintf(&sz, "%s", tmp);
     2227            mr_asprintf(sz, "%s", tmp);
    22282228            mr_free(tmp);
    2229             mr_asprintf(&tmp, "/%s", sz);
     2229            mr_asprintf(tmp, "/%s", sz);
    22302230            mr_free(sz);
    22312231        }
     
    23372337            if (bkpinfo->media_device[0]) {
    23382338                if (bkpinfo->backup_media_type == usb) {
    2339                     mr_asprintf(&tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
     2339                    mr_asprintf(tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
    23402340                } else {
    2341                     mr_asprintf(&tmp, "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, bkpinfo->media_device);
     2341                    mr_asprintf(tmp, "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, bkpinfo->media_device);
    23422342                }
    23432343                if (!ask_me_yes_or_no(tmp)) {
     
    24052405        }
    24062406        if (bkpinfo->media_device[0]) {
    2407             mr_asprintf(&tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
     2407            mr_asprintf(tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
    24082408            if (!ask_me_yes_or_no(tmp)) {
    24092409                bkpinfo->media_device[0] = '\0';
     
    24202420            }
    24212421        }
    2422         mr_asprintf(&tmp, "ls -l %s", bkpinfo->media_device);
     2422        mr_asprintf(tmp, "ls -l %s", bkpinfo->media_device);
    24232423        if (run_program_and_log_output(tmp, FALSE)) {
    24242424            log_to_screen("User has not specified a valid /dev entry");
     
    25352535        /*  Force NFS to be the protocol by default */
    25362536        if (bkpinfo->netfs_proto == NULL) {
    2537             mr_asprintf(&(bkpinfo->netfs_proto), "nfs");
     2537            mr_asprintf(bkpinfo->netfs_proto, "nfs");
    25382538        }
    25392539        if (bkpinfo->disaster_recovery) {
     
    25492549        }
    25502550        mr_free(bkpinfo->netfs_proto);
    2551         mr_asprintf(&(bkpinfo->netfs_proto), "%s", tmp1);
     2551        mr_asprintf(bkpinfo->netfs_proto, "%s", tmp1);
    25522552        if (!popup_and_get_string
    25532553            ("Network share", "Which remote share should I mount?",
     
    25702570        mr_free(bkpinfo->netfs_user);
    25712571        if (strcmp(tmp1, "") != 0) {
    2572             mr_asprintf(&(bkpinfo->netfs_user), "%s", tmp1);
     2572            mr_asprintf(bkpinfo->netfs_user, "%s", tmp1);
    25732573        }
    25742574   
     
    25852585            if (bkpinfo->restore_data) {
    25862586                /*  mount th FS read-only in restore mode to avoid any erase of whatever */
    2587                 mr_asprintf(&tmpro, "-o ro");
     2587                mr_asprintf(tmpro, "-o ro");
    25882588            } else {
    2589                 mr_asprintf(&tmpro, "");
     2589                mr_asprintf(tmpro, "");
    25902590            }
    25912591
    25922592            /*  Build the mount string */
    25932593            if (strstr(bkpinfo->netfs_proto, "smbfs")) {
    2594                 mr_asprintf(&tmp, "mount -t cifs %s %s %s",bkpinfo->netfs_mount, bkpinfo->isodir,tmpro);
     2594                mr_asprintf(tmp, "mount -t cifs %s %s %s",bkpinfo->netfs_mount, bkpinfo->isodir,tmpro);
    25952595                if (bkpinfo->netfs_user) {
    25962596                    mr_strcat(tmp, " -o user=%s", bkpinfo->netfs_user);
     
    25982598            else {
    25992599                if (strstr(bkpinfo->netfs_proto, "sshfs")) {
    2600                     mr_asprintf(&tmp, "sshfs %s ",tmpro);
     2600                    mr_asprintf(tmp, "sshfs %s ",tmpro);
    26012601                } else {
    2602                     mr_asprintf(&tmp, "mount -t %s -o nolock %s ", bkpinfo->netfs_proto,tmpro);
     2602                    mr_asprintf(tmp, "mount -t %s -o nolock %s ", bkpinfo->netfs_proto,tmpro);
    26032603                }
    26042604                if (bkpinfo->netfs_user) {
     
    27882788        }
    27892789        mr_free(bkpinfo->exclude_paths);
    2790         mr_asprintf(&tmp, "%s", p);
     2790        mr_asprintf(tmp, "%s", p);
    27912791        bkpinfo->exclude_paths = tmp;
    27922792
     
    28152815        if (ask_me_yes_or_no("Do you want to backup extended attributes?")) {
    28162816            if (find_home_of_exe("getfattr")) {
    2817                 mr_asprintf(&g_getfattr,"getfattr");
     2817                mr_asprintf(g_getfattr,"getfattr");
    28182818            }
    28192819            if (find_home_of_exe("getfacl")) {
    2820                 mr_asprintf(&g_getfacl,"getfacl");
     2820                mr_asprintf(g_getfacl,"getfacl");
    28212821            }
    28222822            log_it("Backup of extended attributes");
     
    29342934    char *exclude_these_directories = NULL;
    29352935
    2936     mr_asprintf(&exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,vmhgfs,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' '|' | awk '{print $0;}'"));
     2936    mr_asprintf(exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,vmhgfs,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' '|' | awk '{print $0;}'"));
    29372937    log_msg(9,"list_of_NETFS_mounts_only returns %s\n",exclude_these_directories);
    29382938    return(exclude_these_directories);
     
    30333033//  log_it("Asking what_number_cd_is_this");
    30343034    if (g_ISO_restore_mode) {
    3035         mr_asprintf(&tmp, "mount | grep iso9660 | awk '{print $3;}'");
    3036 
    3037         mr_asprintf(&mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");
     3035        mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'");
     3036
     3037        mr_asprintf(mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");
    30383038        cd_number = atoi(last_line_of_file(mountdev));
    30393039        paranoid_free(mountdev);
     
    30433043    }
    30443044
    3045     mr_asprintf(&mountdev, "%s", bkpinfo->media_device);
     3045    mr_asprintf(mountdev, "%s", bkpinfo->media_device);
    30463046    if (!mountdev[0]) {
    30473047        log_it
     
    31773177    assert(which_device != NULL);
    31783178
    3179     mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted());
     3179    mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted());
    31803180    log_it("list_drives_cmd = %s", list_drives_cmd);
    31813181
     
    32193219    } else {
    32203220        // We need to look on each partition then
    3221         mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
     3221        mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
    32223222        log_it("list_drives_cmd = %s", list_drives_cmd);
    32233223
     
    33223322            log_msg(1, "curr_fname = %s", curr_fname);
    33233323            sprintf(command, "file %s", curr_fname);
    3324             mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     3324            mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    33253325            for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' ';
    33263326                 p--);
    33273327            p++;
    3328             mr_asprintf(&scratch, "%s", p);
     3328            mr_asprintf(scratch, "%s", p);
    33293329            for (p = scratch; *p != '\0' && *p != '\''; p++);
    33303330            *p = '\0';
     
    33733373    sprintf(fdisk, "/sbin/parted2fdisk");
    33743374    sprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
    3375     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     3375    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    33763376    if (strstr(tmp, "GPT") == NULL) {
    33773377        strcpy(output, "MBR");
Note: See TracChangeset for help on using the changeset viewer.