From 4e99cc60d3af0a1a8e195f6dd2f107f3769118e0 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 29 Mar 2015 20:28:32 +0200 Subject: While debugging write broken frames in individual files --- ipecamera/data.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ipecamera') diff --git a/ipecamera/data.c b/ipecamera/data.c index bdc067e..2bcccd5 100644 --- a/ipecamera/data.c +++ b/ipecamera/data.c @@ -64,9 +64,11 @@ inline static int ipecamera_decode_frame(ipecamera_t *ctx, pcilib_event_id_t eve #ifdef IPECAMERA_DEBUG_BROKEN_FRAMES char name[128]; sprintf(name, "%s/broken.%4lu", IPECAMERA_DEBUG_BROKEN_FRAMES, ctx->event_id); - FILE *f = fopen("/mnt/frames/broken", "w"); - fwrite(ctx->buffer + buf_ptr * ctx->padded_size, ctx->raw_size, 1, f); - fclose(f); + FILE *f = fopen(name, "w"); + if (f) { + fwrite(ctx->buffer + buf_ptr * ctx->padded_size, ctx->raw_size, 1, f); + fclose(f); + } #endif /* IPECAMERA_DEBUG_BROKEN_FRAMES */ err = PCILIB_ERROR_FAILED; ctx->frame[buf_ptr].event.image_broken = err; -- cgit v1.2.3