diff --git a/lib/init.c b/lib/init.c index cf51500..2fdc3c2 100644 --- a/lib/init.c +++ b/lib/init.c @@ -293,8 +293,13 @@ iscsi_set_error(struct iscsi_context *iscsi, const char *error_string, ...) } va_end(ap); - strncpy(iscsi->error_string,errstr,MAX_STRING_SIZE); - DPRINTF(iscsi,1,"%s",iscsi->error_string); + if (iscsi != NULL) { + strncpy(iscsi->error_string,errstr,MAX_STRING_SIZE); + DPRINTF(iscsi,1,"%s",iscsi->error_string); + } + else { + fprintf(stderr,"libiscsi: %s\n", errstr); + } } void