Changeset 2376 in MondoRescue


Ignore:
Timestamp:
Sep 9, 2009, 12:37:59 PM (15 years ago)
Author:
Bruno Cornec
Message:
  • replace system("sync") by sync() calls
Location:
branches/2.2.10/mondo/src
Files:
9 edited

Legend:

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

    r2357 r2376  
    17221722                    ("Failed to write to disk. I shall blank it and then try again.");
    17231723                sleep(5);
    1724                 (void)system("sync");
     1724                sync();
    17251725                pause_for_N_seconds(5, "Letting DVD drive settle");
    17261726
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2375 r2376  
    13501350
    13511351        while (what_number_cd_is_this() != cd_number_i_want) {
    1352             paranoid_system("sync");
     1352            sync();
    13531353            if (is_this_device_mounted(MNT_CDROM)) {
    13541354                res =
     
    13721372                inject_device(bkpinfo->media_device);
    13731373            }
    1374             paranoid_system("sync");
     1374            sync();
    13751375        }
    13761376        mr_free(request);
  • branches/2.2.10/mondo/src/common/libmondo-fifo.c

    r2332 r2376  
    8585    wise_upper_limit = (am_I_in_disaster_recovery_mode()? 8 : 32);
    8686    wise_lower_limit = 1;       // wise_upper_limit/2 + 1;
    87     paranoid_system("sync");
     87    sync();
    8888    for (bufsize = wise_upper_limit, res = -1;
    8989         res != 0 && bufsize >= wise_lower_limit; bufsize--) {
     
    162162        return;
    163163    }
    164     paranoid_system("sync");
     164    sync();
    165165    mr_asprintf(command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer);
    166166    log_msg(2, "kill_buffer() --- command = %s", command);
  • branches/2.2.10/mondo/src/common/libmondo-stream.c

    r2334 r2376  
    134134    }
    135135    sleep(1);
    136     paranoid_system("sync");
     136    sync();
    137137    sleep(1);
    138138    paranoid_pclose(g_tape_stream);
     
    173173
    174174    sleep(1);
    175     paranoid_system("sync");
     175    sync();
    176176    sleep(1);
    177177    log_it("closeout_tape() -- entering");
     
    14671467
    14681468    paranoid_pclose(g_tape_stream);
    1469     system("sync");
    1470     system("sync");
    1471     system("sync");
     1469    sync();
     1470    sync();
     1471    sync();
    14721472    log_it("New tape requested.");
    14731473    insist_on_this_tape_number(g_current_media_number + 1); // will increment g_current_media, too
  • branches/2.2.10/mondo/src/common/libmondo-verify.c

    r2357 r2376  
    9292
    9393    mr_asprintf(afio_found_changes, "%s.afio", ignorefiles_fname);
    94     paranoid_system("sync");
     94    sync();
    9595
    9696    log_msg(1, "Now scanning log file for 'afio: ' stuff");
     
    11771177    retval += verify_biggiefiles_from_stream();
    11781178/* find the final blocks */
    1179     paranoid_system("sync");
     1179    sync();
    11801180    sleep(2);
    11811181    closein_tape();
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2357 r2376  
    9999    long g_start_time = 0L;     ///< The time (in seconds since the epoch) that the progress form was opened.
    100100    bool g_text_mode = TRUE;    ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface.
    101     char g_xmondo_stdin[MAX_NEWT_COMMENT_LEN],  ///< ... @bug Unneeded w/current XMondo.
    102      g_xmondo_stdout[MAX_NEWT_COMMENT_LEN]; ///< .... @bug Unneeded w/current XMondo.
    103     bool g_called_by_xmondo = FALSE;    ///< @bug Unneeded w/current XMondo.
    104101    char *g_selfmounted_isodir; ///< Holds the NFS mountpoint if mounted via mondoarchive.
    105102
    106103/* @} - end of globalGroup */
    107 
    108 //int g_fd_in=-1, g_fd_out=-1;
    109104
    110105    void popup_and_OK(char *);
     
    130125        if (g_text_mode) {
    131126            while (1) {
    132                 system("sync");
     127                sync();
    133128                printf("---promptdialogYN---1--- %s\n---promptdialogYN---Q--- [yes] [no] ---\n--> ", prompt);
    134129                mr_getline(tmp, stdin);
     
    147142                    return (FALSE);
    148143                } else {
    149                     system("sync");
     144                    sync();
    150145                    printf("Please enter either YES or NO (or yes or no, or y or n, or...)\n");
    151146                }
     
    172167
    173168        if (g_text_mode) {
    174             system("sync");
     169            sync();
    175170            printf("---promptdialogOKC---1--- %s\n---promptdialogOKC---Q--- [OK] [Cancel] ---\n--> ", prompt);
    176171            mr_getline(tmp, stdin);
  • branches/2.2.10/mondo/src/mondorestore/mondo-prep.c

    r2357 r2376  
    118118                }
    119119            }
    120             system("sync");
    121             system("sync");
    122             system("sync");
     120            sync();
     121            sync();
     122            sync();
    123123            popup_and_OK
    124124                ("I must now reboot. Please leave the boot media in the drive and repeat your actions - e.g. type 'nuke' - and it should work fine.");
     
    277277        if (res && strstr(command, "create") && vacuum_pack) {
    278278            sleep(2);
    279             system("sync");
    280             system("sync");
    281             system("sync");
     279            sync();
     280            sync();
     281            sync();
    282282        }
    283283        if ((p = strstr(incoming, "vgcreate"))) {
     
    408408    }
    409409    paranoid_free(command);
    410     system("sync");
    411     system("sync");
    412     system("sync");
     410    sync();
     411    sync();
     412    sync();
    413413    sleep(1);
    414414    log_it("ENDING");
     
    764764        log_to_screen("Stopping %s", device);
    765765        stop_raid_device(device);
    766         system("sync");
     766        sync();
    767767        sleep(1);
    768768
     
    776776            res = run_program_and_log_output(program, 1);
    777777            log_msg(1, "%s returned %d", program, res);
    778             system("sync");
     778            sync();
    779779            sleep(3);
    780780            start_raid_device(device);
     
    784784            mr_free(program);
    785785        }
    786         system("sync");
     786        sync();
    787787        sleep(2);
    788788#endif
    789         system("sync");
     789        sync();
    790790        sleep(1);
    791791        newtResume();
     
    849849    mr_free(program);
    850850    retval += res;
    851     system("sync");
     851    sync();
    852852    sleep(1);
    853853    return (retval);
     
    901901    log_msg(1, "Stopping all RAID devices");
    902902    stop_all_raid_devices(mountlist);
    903     system("sync");
    904     system("sync");
    905     system("sync");
     903    sync();
     904    sync();
     905    sync();
    906906    sleep(2);
    907907    log_msg(1, "Prepare soft-RAIDs");   // prep and format too
     
    925925        }
    926926    }
    927     system("sync");
    928     system("sync");
    929     system("sync");
     927    sync();
     928    sync();
     929    sync();
    930930    sleep(2);
    931931// This last step is probably necessary
     
    10281028                ("Please choose 'yes' to reboot and try again; or 'no' to ignore this warning and continue."))
    10291029            {
    1030                 system("sync");
    1031                 system("sync");
    1032                 system("sync");
     1030                sync();
     1031                sync();
     1032                sync();
    10331033                system("reboot");
    10341034            }
     
    15211521                }
    15221522            }
    1523             system("sync");
     1523            sync();
    15241524#else
    15251525            log_it("New, kernel-friendly partition remover");
     
    15841584        // close fdisk
    15851585        fput_string_one_char_at_a_time(pout_to_fdisk, "w\n");
    1586         system("sync");
     1586        sync();
    15871587        paranoid_pclose(pout_to_fdisk);
    15881588        log_msg(0,
     
    22152215        log_msg(1, "Warning - unable to stop some RAID devices");
    22162216    }
    2217     system("sync");
    2218     system("sync");
    2219     system("sync");
     2217    sync();
     2218    sync();
     2219    sync();
    22202220    sleep(1);
    22212221    return (retval);
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2357 r2376  
    624624            log_msg(2, "Failed to mount device.");
    625625            sleep(5);
    626             run_program_and_log_output("sync", FALSE);
     626            sync();
    627627        }
    628628    }
     
    13711371    name = read_cfg_var(g_mondo_cfg_file, "bootloader.name");
    13721372    log_msg(2, "run_boot_loader: device='%s', name='%s'", device, name);
    1373     system("sync");
     1373    sync();
    13741374
    13751375    offer_to_make_initrd();
     
    20262026    }
    20272027
    2028     paranoid_system("sync");
     2028    sync();
    20292029
    20302030    mr_asprintf(tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE);
  • branches/2.2.10/mondo/src/mondorestore/mondorestore.c

    r2352 r2376  
    811811                log_to_screen("Preparing to format your disk(s)");
    812812                sleep(1);
    813                 system("sync");
     813                sync();
    814814                log_to_screen("Please wait. This may take a few minutes.");
    815815                res += format_everything(mountlist, FALSE, raidlist);
     
    29252925                                "Run complete. Please remove media and reboot.");
    29262926        } else {
    2927             run_program_and_log_output("sync", FALSE);
     2927            sync();
    29282928            if (is_this_device_mounted(MNT_CDROM)) {
    29292929                run_program_and_log_output("umount " MNT_CDROM, FALSE);
Note: See TracChangeset for help on using the changeset viewer.