long filepos;
char *jobid_s,
*event_file = NULL;
+ int err = 0;
+#define _err(n) { err = n; goto out; }
edg_wll_ResetError(ctx);
jobid_s = edg_wlc_JobIdGetUnique(jobid);
if ( !jobid_s ) {
edg_wll_SetError(ctx, ENOMEM, "edg_wlc_JobIdGetUnique()");
- goto out;
+ _err(1);
}
asprintf(&event_file, "%s.%s", lbproxy_ilog_file_prefix, jobid_s);
if ( !event_file ) {
edg_wll_SetError(ctx, ENOMEM, "asprintf()");
- goto out;
+ _err(1);
}
if ( edg_wll_log_event_write(ctx, event_file, event,
FCNTL_ATTEMPTS, FCNTL_TIMEOUT, &filepos) ) {
edg_wll_UpdateError(ctx, 0, "edg_wll_log_event_write()");
- goto out;
+ _err(1);
}
if ( edg_wll_log_event_send(ctx, lbproxy_ilog_socket_path, filepos,
event, strlen(event), 1, &timeout) ) {
edg_wll_UpdateError(ctx, 0, "edg_wll_log_event_send()");
- goto out;
+ _err(-1);
}
out:
if ( jobid_s ) free(jobid_s);
if ( event_file ) free(event_file);
- return edg_wll_Error(ctx, NULL, NULL)? edg_wll_UpdateError(ctx, 0, "edg_wll_EventSendProxy()"): 0;
+ if ( !err ) return 0;
+ edg_wll_UpdateError(ctx, 0, "edg_wll_EventSendProxy()");
+ if ( err < 0 ) return 0;
+ return edg_wll_Error(ctx, NULL, NULL);
}