error.c
author viric <viriketo@gmail.com>
Mon, 18 Jul 2011 22:48:54 +0200
branchqueuelimit
changeset 293 bb87d5e7c466
parent 286 f648473fd056
permissions -rw-r--r--
Closing this branch, where I wrote bad code about adding the proper handling of queue limits by blocking clients.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
102
27b0f0e44de8 Added copyright headers to the new files. I always forget that.
viric@llimona
parents: 92
diff changeset
     1
/*
27b0f0e44de8 Added copyright headers to the new files. I always forget that.
viric@llimona
parents: 92
diff changeset
     2
    Task Spooler - a task queue system for the unix user
267
11631dd11ff8 Updating copyright years in the source.
viric@mandarina
parents: 254
diff changeset
     3
    Copyright (C) 2007-2009  LluĂ­s Batlle i Rossell
102
27b0f0e44de8 Added copyright headers to the new files. I always forget that.
viric@llimona
parents: 92
diff changeset
     4
27b0f0e44de8 Added copyright headers to the new files. I always forget that.
viric@llimona
parents: 92
diff changeset
     5
    Please find the license in the provided COPYING file.
27b0f0e44de8 Added copyright headers to the new files. I always forget that.
viric@llimona
parents: 92
diff changeset
     6
*/
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
     7
#include <unistd.h>
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
     8
#include <stdio.h>
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
     9
#include <time.h>
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    10
#include <sys/types.h>
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    11
#include <errno.h>
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    12
#include <string.h>
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    13
#include <fcntl.h>
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    14
#include <sys/stat.h>
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    15
#include <stdarg.h>
105
98b6955472dd Fixed warning in error.c
viric@llimona
parents: 104
diff changeset
    16
#include <stdlib.h>
146
5e689cb593aa Bones of the "-i" parameter, job info.
viric@llimona
parents: 117
diff changeset
    17
#include <sys/time.h>
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    18
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    19
#include "main.h"
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    20
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
    21
enum Etype
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
    22
{
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
    23
    WARNING,
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
    24
    ERROR
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
    25
};
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
    26
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    27
/* Declared in main.h as extern */
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    28
enum Process_type process_type;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    29
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    30
static int real_errno;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    31
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    32
/* Local protos */
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    33
static void dump_structs(FILE *out);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    34
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    35
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    36
static void print_date(FILE *out)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    37
{
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    38
    time_t t;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    39
    const char *tstr;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    40
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    41
    t = time(NULL);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    42
    tstr = ctime(&t);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    43
104
dc4dd9939238 Fixed error reporting.
viric@llimona
parents: 102
diff changeset
    44
    fprintf(out, "date %s", tstr);
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    45
}
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    46
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    47
static void dump_proc_info(FILE *out)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    48
{
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    49
    print_date(out);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    50
    fprintf(out, "pid %i\n", getpid());
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    51
    if (process_type == SERVER)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    52
        fprintf(out, "type SERVER\n");
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    53
    else if (process_type == CLIENT)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    54
        fprintf(out, "type CLIENT\n");
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    55
    else
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    56
        fprintf(out, "type UNKNOWN\n");
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    57
}
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    58
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    59
static FILE * open_error_file()
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    60
{
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    61
    int fd;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    62
    FILE* out;
251
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    63
    char *path;
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    64
    int new_size;
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    65
    char *new_path;
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    66
251
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    67
    create_socket_path(&path);
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    68
    new_size = strlen(path)+10;
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    69
    new_path = malloc(new_size);
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    70
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    71
    strncpy(new_path, path, new_size);
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    72
    strncat(new_path, ".error", (new_size - strlen(path)) - 1);
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    73
    free(path);
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    74
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    75
    fd = open(new_path, O_CREAT | O_APPEND | O_WRONLY, 0600);
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    76
    if (fd == -1)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    77
        return 0;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    78
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    79
    out = fdopen(fd, "a");
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    80
    if (out == NULL)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    81
    {
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    82
        close(fd);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    83
        return 0;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    84
    }
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    85
251
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    86
    free(new_path);
5e0802df5788 Making a ts.error file for each socket ($TS_SOCKET.error)
viric@mandarina
parents: 231
diff changeset
    87
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    88
    return out;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    89
}
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    90
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    91
static void print_error(FILE *out, enum Etype type, const char *str, va_list ap)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    92
{
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    93
    if (type == ERROR)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    94
        fprintf(out, "Error\n");
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    95
    else if (type == WARNING)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    96
        fprintf(out, "Warning\n");
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    97
    else
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    98
        fprintf(out, "Unknown kind of error\n");
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
    99
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   100
    fprintf(out, " Msg: ");
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   101
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   102
    vfprintf(out, str, ap);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   103
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   104
    fprintf(out, "\n");
104
dc4dd9939238 Fixed error reporting.
viric@llimona
parents: 102
diff changeset
   105
    fprintf(out, " errno %i, \"%s\"\n", real_errno, strerror(real_errno));
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   106
}
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   107
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   108
static void problem(enum Etype type, const char *str, va_list ap)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   109
{
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   110
    FILE *out;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   111
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   112
    out = open_error_file();
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   113
    if (out == 0)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   114
        return;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   115
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   116
    /* out is ready */
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   117
    print_error(out, type, str, ap);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   118
    dump_structs(out);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   119
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   120
    /* this will close the fd also */
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   121
    fclose(out);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   122
}
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   123
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   124
static void problem_msg(enum Etype type, const struct msg *m, const char *str, va_list ap)
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   125
{
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   126
    FILE *out;
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   127
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   128
    out = open_error_file();
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   129
    if (out == 0)
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   130
        return;
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   131
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   132
    /* out is ready */
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   133
    print_error(out, type, str, ap);
286
f648473fd056 Enabling a heavier msgdump. I still don't get what goes wrong.
viric <viriketo@gmail.com>
parents: 267
diff changeset
   134
    msgdump(out, "problem", m);
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   135
    dump_structs(out);
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   136
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   137
    /* this will close the fd also */
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   138
    fclose(out);
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   139
}
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   140
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   141
void error(const char *str, ...)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   142
{
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   143
    va_list ap;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   144
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   145
    va_start(ap, str);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   146
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   147
    real_errno = errno;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   148
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   149
    problem(ERROR, str, ap);
104
dc4dd9939238 Fixed error reporting.
viric@llimona
parents: 102
diff changeset
   150
    exit(-1);
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   151
}
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   152
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   153
void error_msg(const struct msg *m, const char *str, ...)
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   154
{
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   155
    va_list ap;
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   156
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   157
    va_start(ap, str);
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   158
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   159
    real_errno = errno;
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   160
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   161
    problem_msg(ERROR, m, str, ap);
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   162
    exit(-1);
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   163
}
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   164
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   165
void warning(const char *str, ...)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   166
{
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   167
    va_list ap;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   168
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   169
    va_start(ap, str);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   170
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   171
    real_errno = errno;
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   172
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   173
    problem(WARNING, str, ap);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   174
}
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   175
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   176
void warning_msg(const struct msg *m, const char *str, ...)
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   177
{
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   178
    va_list ap;
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   179
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   180
    va_start(ap, str);
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   181
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   182
    real_errno = errno;
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   183
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   184
    problem_msg(WARNING, m, str, ap);
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   185
}
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 105
diff changeset
   186
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   187
static void dump_structs(FILE *out)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   188
{
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   189
    dump_proc_info(out);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   190
    if (process_type == SERVER)
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   191
    {
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   192
        dump_jobs_struct(out);
254
41252d5e85f5 Fixed a bug in the notify list, reported by mark meissonnier.
viric@mandarina
parents: 251
diff changeset
   193
        dump_notifies_struct(out);
92
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   194
        dump_conns_struct(out);
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   195
    }
05004c52ecff Better error reports on internal handled errors.
viric@llimona
parents:
diff changeset
   196
}