X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Ffilter%2Fmemstream.h;h=6990b6fd709189e99b55416b93e11cd5f7604389;hp=2cbb03559b154c322e0bb7f8f3c1518c72fa0f75;hb=62a7b8edf965b89d3ca57da120dcedfcf36dfe02;hpb=d00c599e39ae45ec7c8e12e6bac6b5e58f08f817 diff --git a/src/lib/lttng-ctl/filter/memstream.h b/src/lib/lttng-ctl/filter/memstream.h index 2cbb03559..6990b6fd7 100644 --- a/src/lib/lttng-ctl/filter/memstream.h +++ b/src/lib/lttng-ctl/filter/memstream.h @@ -19,9 +19,6 @@ * all copies or substantial portions of the Software. */ -#define _GNU_SOURCE -#include - #ifdef LTTNG_HAVE_FMEMOPEN #include @@ -73,25 +70,25 @@ FILE *lttng_fmemopen(void *buf, size_t size, const char *mode) } ret = fseek(fp, 0L, SEEK_SET); if (ret < 0) { - perror("fseek"); + PERROR("fseek"); goto error_close; } /* We keep the handle open, but can unlink the file on the VFS. */ ret = unlink(tmpname); if (ret < 0) { - perror("unlink"); + PERROR("unlink"); } return fp; error_close: ret = fclose(fp); if (ret < 0) { - perror("close"); + PERROR("close"); } error_unlink: ret = unlink(tmpname); if (ret < 0) { - perror("unlink"); + PERROR("unlink"); } return NULL; } @@ -148,14 +145,14 @@ FILE *lttng_open_memstream(char **ptr, size_t *sizeloc) */ ret = unlink(tmpname); if (ret < 0) { - perror("unlink"); + PERROR("unlink"); } return fp; error_unlink: ret = unlink(tmpname); if (ret < 0) { - perror("unlink"); + PERROR("unlink"); } return NULL; } @@ -170,17 +167,17 @@ int lttng_close_memstream(char **buf, size_t *size, FILE *fp) ret = fflush(fp); if (ret < 0) { - perror("fflush"); + PERROR("fflush"); return ret; } ret = fseek(fp, 0L, SEEK_END); if (ret < 0) { - perror("fseek"); + PERROR("fseek"); return ret; } pos = ftell(fp); if (ret < 0) { - perror("ftell"); + PERROR("ftell"); return ret; } *size = pos; @@ -191,7 +188,7 @@ int lttng_close_memstream(char **buf, size_t *size, FILE *fp) } ret = fseek(fp, 0L, SEEK_SET); if (ret < 0) { - perror("fseek"); + PERROR("fseek"); goto error_free; } /* Copy the entire file into the buffer */ @@ -207,7 +204,7 @@ int lttng_close_memstream(char **buf, size_t *size, FILE *fp) } ret = fclose(fp); if (ret < 0) { - perror("fclose"); + PERROR("fclose"); return ret; } return 0; @@ -215,7 +212,7 @@ int lttng_close_memstream(char **buf, size_t *size, FILE *fp) error_close: ret = fclose(fp); if (ret < 0) { - perror("fclose"); + PERROR("fclose"); } error_free: free(*buf);