Ignore:
Timestamp:
Jul 22, 2009, 2:11:26 PM (15 years ago)
Author:
Bruno Cornec
Message:
  • Fix a printing error in mindi for the tar command
  • Fix all mr_asprintf which had no second param as a string

(report bug fix done originaly in 2.2.9)

File:
1 edited

Legend:

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

    r2266 r2291  
    11421142    mr_free(device_with_space);
    11431143    paranoid_pclose(fin);
    1144     mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null",
    1145             SWAPLIST_COMMAND, device_with_space);
     1144    mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
    11461145    log_msg(4, "tmp (command) = '%s'", tmp);
    11471146    if (!system(tmp)) {
     
    12921291
    12931292#ifdef __FreeBSD__
    1294         mr_asprintf(&dev, make_vn(device));
     1293        mr_asprintf(&dev, "%s", make_vn(device));
    12951294        if (!dev) {
    12961295            mr_asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", device);
     
    13091308
    13101309#ifdef __FreeBSD__
    1311     mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s",
    1312             device, mountpoint, MONDO_LOGFILE);
     1310    mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    13131311
    13141312#else
    1315     mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s",
    1316             device, options, mountpoint, MONDO_LOGFILE);
     1313    mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
    13171314    paranoid_free(options);
    13181315#endif
     
    16091606            if (bkpinfo->media_device[0]) {
    16101607                if (bkpinfo->backup_media_type == usb) {
    1611                     mr_asprintf(&tmp,
    1612                         "I think your %s media corresponds to %s. Is this correct?", mds,
    1613                         bkpinfo->media_device);
     1608                    mr_asprintf(&tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
    16141609                } else {
    1615                     mr_asprintf(&tmp,
    1616                         "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,
    1617                         bkpinfo->media_device);
     1610                    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);
    16181611                }
    16191612                if (!ask_me_yes_or_no(tmp)) {
     
    16831676        }
    16841677        if (bkpinfo->media_device[0]) {
    1685             mr_asprintf(&tmp,
    1686                     "I think I've found your tape streamer at %s; am I right on the money?",
    1687                     bkpinfo->media_device);
     1678            mr_asprintf(&tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
    16881679            if (!ask_me_yes_or_no(tmp)) {
    16891680                bkpinfo->media_device[0] = '\0';
     
    18121803            mr_free(command);
    18131804
    1814             mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount,
    1815                     bkpinfo->isodir);
     1805            mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir);
    18161806            run_program_and_log_output(tmp, 3);
    18171807            mr_free(tmp);
     
    18251815            finish(1);
    18261816        }
    1827         mr_asprintf(&tmp, bkpinfo->nfs_remote_dir);
     1817        mr_asprintf(&tmp, "%s", bkpinfo->nfs_remote_dir);
    18281818        if (!popup_and_get_string
    18291819            ("Directory", "Which directory within that mountpoint?", tmp,
     
    19771967        mr_free(tmp);
    19781968// NTFS
    1979         mr_asprintf(&tmp, "%s",
    1980                call_program_and_get_last_line_of_output
    1981                ("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
     1969        mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
    19821970        if (strlen(tmp) > 2) {
    19831971            if (!popup_and_get_string
     
    21052093
    21062094    mr_asprintf(&exclude_these_directories,"%s",list_of_NFS_mounts_only());
    2107     mr_asprintf(&exclude_these_devices,"%s",
    2108            call_program_and_get_last_line_of_output
    2109            ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2095    mr_asprintf(&exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
    21102096    snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices);
    21112097    mr_free(exclude_these_devices);
     
    21282114    static char result_sz[512];
    21292115
    2130     mr_asprintf(&exclude_these_directories,"%s",
    2131            call_program_and_get_last_line_of_output
    2132            ("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2116    mr_asprintf(&exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));
    21332117    snprintf(result_sz, 511, "%s", exclude_these_directories);
    21342118    mr_free(exclude_these_directories);
     
    21842168
    21852169#ifdef __FreeBSD__
    2186     mr_asprintf(&tmp,
    2187            call_program_and_get_last_line_of_output
    2188            ("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2170    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    21892171#else
    2190     mr_asprintf(&tmp,
    2191            call_program_and_get_last_line_of_output
    2192            ("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2172    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    21932173#endif
    21942174
    21952175    if (tmp[0] != '/') {
    2196         mr_asprintf(&sz, tmp);
     2176        mr_asprintf(&sz, "%s", tmp);
    21972177        paranoid_free(tmp);
    21982178        mr_asprintf(&tmp, "/%s", sz);
     
    22922272    }
    22932273
    2294     mr_asprintf(&mountdev, bkpinfo->media_device);
     2274    mr_asprintf(&mountdev, "%s", bkpinfo->media_device);
    22952275    if (!mountdev[0]) {
    22962276        log_it
     
    24252405    assert(which_device != NULL);
    24262406
    2427     mr_asprintf(&list_drives_cmd,
    2428             "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s",
    2429             where_is_root_mounted());
     2407    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());
    24302408    log_it("list_drives_cmd = %s", list_drives_cmd);
    24312409
     
    24692447    } else {
    24702448        // We need to look on each partition then
    2471         mr_asprintf(&list_drives_cmd,
    2472             "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
     2449        mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
    24732450        log_it("list_drives_cmd = %s", list_drives_cmd);
    24742451
     
    25722549            log_msg(1, "curr_fname = %s", curr_fname);
    25732550            mr_asprintf(&command, "file %s", curr_fname);
    2574             mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     2551            mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    25752552            mr_free(command);
    25762553            for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' ';
    25772554                 p--);
    25782555            p++;
    2579             mr_asprintf(&scratch, p);
     2556            mr_asprintf(&scratch, "%s", p);
    25802557            for (p = scratch; *p != '\0' && *p != '\''; p++);
    25812558            *p = '\0';
     
    26262603    mr_free(fdisk);
    26272604
    2628     mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     2605    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    26292606    mr_free(command);
    26302607
Note: See TracChangeset for help on using the changeset viewer.