Changeset 792 in MondoRescue for branches/stable/mondo/mondo/common


Ignore:
Timestamp:
Sep 13, 2006, 11:48:01 PM (18 years ago)
Author:
Bruno Cornec
Message:

Fix Bug #24

  • Introduce kill_anything_like_this as a function instead of define
  • Add an external variable ps_options whose value is empty in restore and auxww in archive
Location:
branches/stable/mondo/mondo/common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/mondo/common/libmondo-fifo.c

    r681 r792  
    136136/* @} - end of globalGroup */
    137137
     138extern char *ps_options;
    138139
    139140/**
     
    210211    }
    211212    sleep(2);
    212     sprintf(tmp, "ps wwax | grep \"%s\"", g_sz_call_to_buffer);
     213    sprintf(tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);
    213214    if (run_program_and_log_output(tmp, 2)) {
    214215        log_msg(2, "Warning - I think I failed to open tape, actually.");
     
    216217    g_tape_buffer_size_MB = bufsize;
    217218    tmp[30] = '\0';
    218     sprintf(command, "ps wwax | grep buffer | grep -v grep");
     219    sprintf(command, "ps %s | grep buffer | grep -v grep", ps_options);
    219220    if (run_program_and_log_output(command, 1)) {
    220221        fres = NULL;
     
    242243    paranoid_system("sync");
    243244    sprintf(command,
    244             "ps wwax | grep -F \"%s\" | grep -Fv grep | awk '{print $1;}' | grep -v PID | tr -s '\n' ' ' | awk '{ print $1; }'",
     245            "ps | grep -F \"%s\" | grep -Fv grep | awk '{print $1;}' | grep -v PID | tr -s '\n' ' ' | awk '{ print $1; }'", ps_options,
    245246            g_sz_call_to_buffer);
    246247    log_msg(2, "kill_buffer() --- command = %s", command);
  • branches/stable/mondo/mondo/common/my-stuff.h

    r686 r792  
    439439 */
    440440#define MALLOC_CHECK_ 1
    441 
    442 /**
    443  * Kill any process containing the string @p x surrounded by spaces in its commandline.
    444  */
    445 #define kill_anything_like_this(x) {run_program_and_log_output("kill `ps wax | grep \"" x "\" | awk '{print $1;}' | grep -vx \"\\?\"`", TRUE);}
    446441
    447442/**
  • branches/stable/mondo/mondo/common/newt-specific.c

    r738 r792  
    128128    extern char *g_boot_mountpt;
    129129    extern char *g_mondo_home;
     130    extern char *ps_options;
    130131
    131132    extern void set_signals(int);
     
    340341    }
    341342
    342 
     343/**
     344 * Kill any process containing the string @p str surrounded by spaces in its commandline.
     345 */
     346void kill_anything_like_this(char *str) {
     347
     348char *tmp = NULL;
     349
     350asprintf(&tmp,"kill `ps %s | grep \"" %s "\" | awk '{print $1;}' | grep -vx \"\\?\"`", ps_options, str);
     351run_program_and_log_output(tmp, TRUE);
     352paranoid_free(tmp);
     353}
    343354
    344355
Note: See TracChangeset for help on using the changeset viewer.