ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/error.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/error.c (file contents):
Revision 1.8 by ats, Wed Apr 7 21:19:26 2004 UTC vs.
Revision 1.11 by ats, Thu Apr 8 11:14:02 2004 UTC

# Line 28 | Line 28
28   #include <stdlib.h>
29  
30   #include "statgrab.h"
31 + #include "tools.h"
32  
33   static sg_error error = SG_ERROR_NONE;
34   #define ERROR_ARG_MAX 256
# Line 35 | Line 36 | static char error_arg[ERROR_ARG_MAX];
36  
37   void sg_set_error(sg_error code, const char *arg) {
38          error = code;
39 <        strlcpy(error_arg, arg, sizeof error_arg);
39 >        if (arg != NULL) {
40 >                sg_strlcpy(error_arg, arg, sizeof error_arg);
41 >        }
42 >        else {
43 >                /* FIXME is this the best idea? */
44 >                error_arg[0] = '\0';
45 >        }
46   }
47  
48   sg_error sg_get_error() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines