Changeset 1061 in MondoRescue for branches/stable/mondo/src/lib


Ignore:
Timestamp:
Jan 18, 2007, 1:47:59 PM (17 years ago)
Author:
Bruno Cornec
Message:
  • mpt + ohci modules added for mindi
  • PATH fixed for init in restore (/usr/games added for petris + fixes)
  • Useless conf files removed from rootfs/etc or cleaned up
  • Still trying to have a working va_list by busybox alignment
Location:
branches/stable/mondo/src/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/lib/mr_err.c

    r1054 r1061  
    3636
    3737void mr_log_exit(int errorcode, const char *message) {
    38     mr_msg(0,message);
     38    mr_msg(0, message);
    3939    mr_exit(errorcode, message);
    4040}
  • branches/stable/mondo/src/lib/mr_mem.c

    r1054 r1061  
    1212#include <stdio.h>
    1313#include <stdlib.h>
    14 #include <stdarg.h>
    1514
    1615#include "mr_err.h"
     
    5352
    5453/* encapsulation function for asprintf */
    55 void mr_asprintf(char **strp, const char *fmt, ...) {
     54void mr_asprintf(char **strp, const char *fmt, va_list args) {
    5655
    57     va_list args;
    5856    int res = 0;
    5957
    60     va_start(args, fmt);
    6158    res = vasprintf(strp, fmt, args);
    6259    if (res == -1) {
    6360        mr_log_exit(-1,"Unable to alloc memory in mr_asprintf\nExiting...");
    6461    }
    65     va_end(args);
    6662}
    6763
  • branches/stable/mondo/src/lib/mr_msg.c

    r1054 r1061  
    3030    if ((fout = fopen(mr_logfile, "w")) == NULL) {
    3131        fprintf(stderr,"Unable to write to %s\n",mr_logfile);
    32         fprintf(stderr,"Logging desactivated\n",mr_logfile);
     32        fprintf(stderr,"Logging desactivated\n");
    3333        mr_msg_close();
    3434    }
     
    4141/*
    4242 * Function that log a message. Not called directly
    43  * but through macros in mr_msg.h
     43 * but through other functions
    4444 */
    45 void _mr_msg(int debug, const char *file, const char *function, int line, const char *fmt, ...) {
     45void _mr_msg(int debug, const char *file, const char *function, int line, const char *fmt, va_list args) {
    4646
    4747    int i = 0;
    4848    int res = 0;
    4949    FILE *fout = NULL;
    50     va_list args;
    5150
    5251    if (mr_logfile == NULL) {
     
    6665            fprintf(fout, "%s->%s#%d: ", file, function, line);
    6766        }
    68         va_start(args, fmt);
    6967        if (vfprintf(fout, fmt, args) < 0) {
    7068            fprintf(stderr,"Unable to print to %s\n",mr_logfile);
     69            return;
    7170        }
    72         va_end(args);
    7371
    7472        fprintf(fout, "\n");
     
    7977}
    8078
    81 void mr_msg(int level, const char *format, ...) {
     79void mr_msg(int level, const char *fmt, va_list args) {
    8280
    83     va_list args;
    84     va_start(args, format);
    85     _mr_msg(level, __FILE__, __FUNCTION__, __LINE__, format, args);
    86     va_end(args);
     81    _mr_msg(level, __FILE__, __FUNCTION__, __LINE__, fmt, args);
    8782}
Note: See TracChangeset for help on using the changeset viewer.