Ignore:
Timestamp:
Jul 22, 2009, 2:03:44 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
File:
1 edited

Legend:

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

    r2257 r2290  
    11481148    mr_free(device_with_space);
    11491149    paranoid_pclose(fin);
    1150     mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null",
    1151             SWAPLIST_COMMAND, device_with_space);
     1150    mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
    11521151    log_msg(4, "tmp (command) = '%s'", tmp);
    11531152    if (!system(tmp)) {
     
    12981297
    12991298#ifdef __FreeBSD__
    1300         mr_asprintf(&dev, make_vn(device));
     1299        mr_asprintf(&dev, "%s", make_vn(device));
    13011300        if (!dev) {
    13021301            mr_asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", device);
     
    13151314
    13161315#ifdef __FreeBSD__
    1317     mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s",
    1318             device, mountpoint, MONDO_LOGFILE);
     1316    mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    13191317
    13201318#else
    1321     mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s",
    1322             device, options, mountpoint, MONDO_LOGFILE);
     1319    mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
    13231320    paranoid_free(options);
    13241321#endif
     
    16081605            if (bkpinfo->media_device[0]) {
    16091606                if (bkpinfo->backup_media_type == usb) {
    1610                     mr_asprintf(&tmp,
    1611                         "I think your %s media corresponds to %s. Is this correct?", mds,
    1612                         bkpinfo->media_device);
     1607                    mr_asprintf(&tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
    16131608                } else {
    1614                     mr_asprintf(&tmp,
    1615                         "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,
    1616                         bkpinfo->media_device);
     1609                    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);
    16171610                }
    16181611                if (!ask_me_yes_or_no(tmp)) {
     
    16821675        }
    16831676        if (bkpinfo->media_device[0]) {
    1684             mr_asprintf(&tmp,
    1685                     "I think I've found your tape streamer at %s; am I right on the money?",
    1686                     bkpinfo->media_device);
     1677            mr_asprintf(&tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
    16871678            if (!ask_me_yes_or_no(tmp)) {
    16881679                bkpinfo->media_device[0] = '\0';
     
    18111802            sprintf(command, "mkdir -p %s", bkpinfo->isodir);
    18121803            run_program_and_log_output(command, 5);
    1813             mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount,
    1814                     bkpinfo->isodir);
     1804            mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir);
    18151805            run_program_and_log_output(tmp, 3);
    18161806            mr_free(tmp);
     
    18241814            finish(1);
    18251815        }
    1826         mr_asprintf(&tmp, bkpinfo->nfs_remote_dir);
     1816        mr_asprintf(&tmp, "%s", bkpinfo->nfs_remote_dir);
    18271817        if (!popup_and_get_string
    18281818            ("Directory", "Which directory within that mountpoint?", tmp,
     
    19761966        mr_free(tmp);
    19771967// NTFS
    1978         mr_asprintf(&tmp, "%s",
    1979                call_program_and_get_last_line_of_output
    1980                ("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
     1968        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};'"));
    19811969        if (strlen(tmp) > 2) {
    19821970            if (!popup_and_get_string
     
    21062094
    21072095    mr_asprintf(&exclude_these_directories,"%s",list_of_NFS_mounts_only());
    2108     mr_asprintf(&exclude_these_devices,"%s",
    2109            call_program_and_get_last_line_of_output
    2110            ("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;}'"));
     2096    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;}'"));
    21112097    snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices);
    21122098    mr_free(exclude_these_devices);
     
    21292115    static char result_sz[512];
    21302116
    2131     mr_asprintf(&exclude_these_directories,"%s",
    2132            call_program_and_get_last_line_of_output
    2133            ("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;}'"));
     2117    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;}'"));
    21342118    snprintf(result_sz, 511, "%s", exclude_these_directories);
    21352119    mr_free(exclude_these_directories);
     
    21862170
    21872171#ifdef __FreeBSD__
    2188     mr_asprintf(&tmp,
    2189            call_program_and_get_last_line_of_output
    2190            ("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;}'"));
     2172    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;}'"));
    21912173#else
    2192     mr_asprintf(&tmp,
    2193            call_program_and_get_last_line_of_output
    2194            ("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;}'"));
     2174    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;}'"));
    21952175#endif
    21962176
    21972177    if (tmp[0] != '/') {
    2198         mr_asprintf(&sz, tmp);
     2178        mr_asprintf(&sz, "%s", tmp);
    21992179        paranoid_free(tmp);
    22002180        mr_asprintf(&tmp, "/%s", sz);
     
    22942274    }
    22952275
    2296     mr_asprintf(&mountdev, bkpinfo->media_device);
     2276    mr_asprintf(&mountdev, "%s", bkpinfo->media_device);
    22972277    if (!mountdev[0]) {
    22982278        log_it
     
    24272407    assert(which_device != NULL);
    24282408
    2429     mr_asprintf(&list_drives_cmd,
    2430             "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s",
    2431             where_is_root_mounted());
     2409    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());
    24322410    log_it("list_drives_cmd = %s", list_drives_cmd);
    24332411
     
    24712449    } else {
    24722450        // We need to look on each partition then
    2473         mr_asprintf(&list_drives_cmd,
    2474             "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
     2451        mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
    24752452        log_it("list_drives_cmd = %s", list_drives_cmd);
    24762453
     
    25752552            log_msg(1, "curr_fname = %s", curr_fname);
    25762553            sprintf(command, "file %s", curr_fname);
    2577             mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     2554            mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    25782555            for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' ';
    25792556                 p--);
    25802557            p++;
    2581             mr_asprintf(&scratch, p);
     2558            mr_asprintf(&scratch, "%s", p);
    25822559            for (p = scratch; *p != '\0' && *p != '\''; p++);
    25832560            *p = '\0';
     
    26292606    log_msg(1, "Using %s", fdisk);
    26302607    sprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
    2631     mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     2608    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    26322609    if (strstr(tmp, "GPT") == NULL) {
    26332610        strcpy(output, "MBR");
Note: See TracChangeset for help on using the changeset viewer.