search for: cleanup_free_stringsbuf

Displaying 20 results from an estimated 77 matches for "cleanup_free_stringsbuf".

2016 Jul 07
0
[PATCH 2/2] daemon: fix cleanup of stringsbuf usages
Declare most of the stringsbuf as CLEANUP_FREE_STRINGSBUF, so they are freed completely on stack unwind: use take_stringsbuf() in return places to take away from the stringsbuf its content, and remove all the manual calls to free_stringslen (no more needed now). This requires to not use free_stringslen anymore on failure in the helper functions of strings...
2016 Jul 07
2
[PATCH 1/2] daemon: free the string on stringsbuf add failure
If add_string_nodup fails free the passed string instead of leaking it, as that string would have been owned by the stringbuf. Adapt few places to this behaviour. --- daemon/btrfs.c | 4 +--- daemon/devsparts.c | 8 ++++---- daemon/guestfsd.c | 1 + 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 9b52aa8..d70565a 100644 ---
2017 Jun 19
0
[PATCH v7 13/13] daemon: Link guestfsd with libutils.
...*ptr) -{ - FILE *f = * (FILE **) ptr; - - if (f) - fclose (f); -} +#include "daemon.h" void cleanup_aug_close (void *ptr) @@ -79,9 +35,6 @@ cleanup_aug_close (void *ptr) aug_close (aug); } -struct stringsbuf; -extern void free_stringsbuf (struct stringsbuf *sb); - void cleanup_free_stringsbuf (void *ptr) { diff --git a/daemon/cleanups.h b/daemon/cleanups.h deleted file mode 100644 index a791244cb..000000000 --- a/daemon/cleanups.h +++ /dev/null @@ -1,51 +0,0 @@ -/* libguestfs - the guestfsd daemon - * Copyright (C) 2009-2015 Red Hat Inc. - * - * This program is free software; you can r...
2015 Jun 17
4
[PATCH 1/4] daemon: introduce free_stringsbuf
Simple shortcut to easily cleanup a stringsbuf. --- daemon/daemon.h | 1 + daemon/guestfsd.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/daemon/daemon.h b/daemon/daemon.h index 53cb797..bed4dbc 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -92,6 +92,7 @@ extern int add_string (struct stringsbuf *sb, const char *str); extern int add_sprintf (struct stringsbuf *sb, const
2020 Jan 09
0
[PATCH v2 4/4] daemon: drop usage of C augeas library
...nups.c +++ b/daemon/cleanups.c @@ -22,19 +22,8 @@ #include <stdlib.h> #include <unistd.h> -#include <augeas.h> - #include "daemon.h" -void -cleanup_aug_close (void *ptr) -{ - augeas *aug = * (augeas **) ptr; - - if (aug != NULL) - aug_close (aug); -} - void cleanup_free_stringsbuf (void *ptr) { diff --git a/daemon/daemon.h b/daemon/daemon.h index 72f1b1a4b..41246c40a 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -100,14 +100,11 @@ extern void cleanup_free_mountable (mountable_t *mountable); /* These functions are used internally by the CLEANUP_* macros. * Don'...
2020 Mar 09
0
[PATCH v3 3/3] daemon: drop usage of C augeas library
...nups.c +++ b/daemon/cleanups.c @@ -22,19 +22,8 @@ #include <stdlib.h> #include <unistd.h> -#include <augeas.h> - #include "daemon.h" -void -cleanup_aug_close (void *ptr) -{ - augeas *aug = * (augeas **) ptr; - - if (aug != NULL) - aug_close (aug); -} - void cleanup_free_stringsbuf (void *ptr) { diff --git a/daemon/daemon.h b/daemon/daemon.h index c6cccea75..da9317bc8 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -100,14 +100,11 @@ extern void cleanup_free_mountable (mountable_t *mountable); /* These functions are used internally by the CLEANUP_* macros. * Don'...
2016 Nov 09
0
[PATCH v2 2/6] New API: yara_load
...the CLEANUP_* macros. Do not call these directly. */ @@ -62,6 +68,15 @@ cleanup_close (void *ptr) } void +cleanup_fclose (void *ptr) +{ + FILE *f = * (FILE **) ptr; + + if (f) + fclose (f); +} + +void cleanup_aug_close (void *ptr) { augeas *aug = * (augeas **) ptr; @@ -78,3 +93,16 @@ cleanup_free_stringsbuf (void *ptr) { free_stringsbuf ((struct stringsbuf *) ptr); } + +#ifdef HAVE_YARA + +void +cleanup_destroy_yara_compiler (void *ptr) +{ + YR_COMPILER *compiler = * (YR_COMPILER **) ptr; + + if (compiler != NULL) + yr_compiler_destroy (compiler); +} + +#endif /* !HAVE_YARA */ diff --git a/...
2017 Apr 25
1
Re: [PATCH v8 4/8] New API: yara_load
...ern void cleanup_free (void *ptr); > extern void cleanup_free_string_list (void *ptr); > extern void cleanup_unlink_free (void *ptr); > extern void cleanup_close (void *ptr); > +extern void cleanup_fclose (void *ptr); > extern void cleanup_aug_close (void *ptr); > extern void cleanup_free_stringsbuf (void *ptr); > > @@ -35,6 +36,7 @@ extern void cleanup_free_stringsbuf (void *ptr); > __attribute__((cleanup(cleanup_free_string_list))) > #define CLEANUP_UNLINK_FREE __attribute__((cleanup(cleanup_unlink_free))) > #define CLEANUP_CLOSE __attribute__((cleanup(cleanup_close)))...
2017 Mar 12
0
[PATCH v4 3/7] New API: yara_load
...eanups.h @@ -26,6 +26,7 @@ extern void cleanup_free (void *ptr); extern void cleanup_free_string_list (void *ptr); extern void cleanup_unlink_free (void *ptr); extern void cleanup_close (void *ptr); +extern void cleanup_fclose (void *ptr); extern void cleanup_aug_close (void *ptr); extern void cleanup_free_stringsbuf (void *ptr); @@ -35,6 +36,7 @@ extern void cleanup_free_stringsbuf (void *ptr); __attribute__((cleanup(cleanup_free_string_list))) #define CLEANUP_UNLINK_FREE __attribute__((cleanup(cleanup_unlink_free))) #define CLEANUP_CLOSE __attribute__((cleanup(cleanup_close))) +#define CLEANUP_FCLOSE...
2016 Jan 21
0
[PATCH v3 2/6] daemon: Split out command() functions and CLEANUP_* macros into separate files.
..._close (void *ptr) +{ + int fd = * (int *) ptr; + + if (fd >= 0) + close (fd); +} + +void +cleanup_aug_close (void *ptr) +{ + augeas *aug = * (augeas **) ptr; + + if (aug != NULL) + aug_close (aug); +} + +struct stringsbuf; +extern void free_stringsbuf (struct stringsbuf *sb); + +void +cleanup_free_stringsbuf (void *ptr) +{ + free_stringsbuf ((struct stringsbuf *) ptr); +} diff --git a/daemon/cleanups.h b/daemon/cleanups.h new file mode 100644 index 0000000..b6ef2ff --- /dev/null +++ b/daemon/cleanups.h @@ -0,0 +1,47 @@ +/* libguestfs - the guestfsd daemon + * Copyright (C) 2009-2015 Red Hat Inc. + * +...
2017 Apr 06
0
[PATCH v6 3/7] New API: yara_load
...eanups.h @@ -26,6 +26,7 @@ extern void cleanup_free (void *ptr); extern void cleanup_free_string_list (void *ptr); extern void cleanup_unlink_free (void *ptr); extern void cleanup_close (void *ptr); +extern void cleanup_fclose (void *ptr); extern void cleanup_aug_close (void *ptr); extern void cleanup_free_stringsbuf (void *ptr); @@ -35,6 +36,7 @@ extern void cleanup_free_stringsbuf (void *ptr); __attribute__((cleanup(cleanup_free_string_list))) #define CLEANUP_UNLINK_FREE __attribute__((cleanup(cleanup_unlink_free))) #define CLEANUP_CLOSE __attribute__((cleanup(cleanup_close))) +#define CLEANUP_FCLOSE...
2017 Apr 24
0
[PATCH v8 4/8] New API: yara_load
...eanups.h @@ -26,6 +26,7 @@ extern void cleanup_free (void *ptr); extern void cleanup_free_string_list (void *ptr); extern void cleanup_unlink_free (void *ptr); extern void cleanup_close (void *ptr); +extern void cleanup_fclose (void *ptr); extern void cleanup_aug_close (void *ptr); extern void cleanup_free_stringsbuf (void *ptr); @@ -35,6 +36,7 @@ extern void cleanup_free_stringsbuf (void *ptr); __attribute__((cleanup(cleanup_free_string_list))) #define CLEANUP_UNLINK_FREE __attribute__((cleanup(cleanup_unlink_free))) #define CLEANUP_CLOSE __attribute__((cleanup(cleanup_close))) +#define CLEANUP_FCLOSE...
2017 Apr 04
0
[PATCH v5 3/7] New API: yara_load
...eanups.h @@ -26,6 +26,7 @@ extern void cleanup_free (void *ptr); extern void cleanup_free_string_list (void *ptr); extern void cleanup_unlink_free (void *ptr); extern void cleanup_close (void *ptr); +extern void cleanup_fclose (void *ptr); extern void cleanup_aug_close (void *ptr); extern void cleanup_free_stringsbuf (void *ptr); @@ -35,6 +36,7 @@ extern void cleanup_free_stringsbuf (void *ptr); __attribute__((cleanup(cleanup_free_string_list))) #define CLEANUP_UNLINK_FREE __attribute__((cleanup(cleanup_unlink_free))) #define CLEANUP_CLOSE __attribute__((cleanup(cleanup_close))) +#define CLEANUP_FCLOSE...
2017 Mar 12
8
[PATCH v4 0/7] Feature: Yara file scanning
Rebase patches on top of 1.37.1. No changes since last series. Matteo Cafasso (7): daemon: expose file upload logic appliance: add yara dependency New API: yara_load New API: yara_destroy New API: internal_yara_scan New API: yara_scan yara_scan: added API tests appliance/packagelist.in | 4 + configure.ac | 1 + daemon/Makefile.am
2017 Jul 14
0
[PATCH 23/27] daemon: Reimplement ‘md_detail’ API in OCaml.
...+++ b/daemon/md.c @@ -218,72 +218,6 @@ do_md_create (const char *name, char *const *devices, #pragma GCC diagnostic pop #endif -char ** -do_md_detail (const char *md) -{ - size_t i; - int r; - - CLEANUP_FREE char *out = NULL, *err = NULL; - CLEANUP_FREE_STRING_LIST char **lines = NULL; - - CLEANUP_FREE_STRINGSBUF DECLARE_STRINGSBUF (ret); - - const char *mdadm[] = { str_mdadm, "-D", "--export", md, NULL }; - r = commandv (&out, &err, mdadm); - if (r == -1) { - reply_with_error ("%s", err); - return NULL; - } - - /* Split the command output into lines */ - li...
2017 Jan 19
3
[PATCH 1/2] daemon: Fix part-to-dev when the partition name includes p<N>.
From: Pino Toscano <ptoscano@redhat.com> If the device name ends with a number, Linux uses partition names of the form <device>p<N>. Handle this case by knocking off the 'p' character. --- daemon/devsparts.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/daemon/devsparts.c b/daemon/devsparts.c index 5862ae2..b764f63 100644 --- a/daemon/devsparts.c +++
2017 Apr 24
10
[PATCH v8 0/8] Feature: Yara file scanning
v8: - Ignore returned value in daemon/upload.c - Report serialization errors in lib/yara.c Matteo Cafasso (8): daemon: ignore unused return value in upload function daemon: expose file upload logic appliance: add yara dependency New API: yara_load New API: yara_destroy New API: internal_yara_scan New API: yara_scan yara_scan: added API tests appliance/packagelist.in
2016 Nov 09
9
[PATCH v2 0/6] Feature: Yara file scanning
v2: - Fix yara dependency in packagelist - Use pkg-config where available - Improve longdesc of yara_load API - Fix libyara initialization and finalization - Import CLEANUP_FCLOSE - Add custom CLEANUP_DESTROY_YARA_COMPILER - Add rules compilation error callback - Other small fixes according to comments Matteo Cafasso (6): appliance: add yara dependency New API: yara_load New API:
2016 Nov 21
2
Re: [PATCH v2 2/6] New API: yara_load
...d of the > previously loaded rules. > > Signed-off-by: Matteo Cafasso <noxdafox@gmail.com> > --- > [...] > diff --git a/daemon/cleanups.c b/daemon/cleanups.c > index 092e493..a02e521 100644 > --- a/daemon/cleanups.c > +++ b/daemon/cleanups.c > @@ -78,3 +93,16 @@ cleanup_free_stringsbuf (void *ptr) > { > free_stringsbuf ((struct stringsbuf *) ptr); > } > + > +#ifdef HAVE_YARA > + > +void > +cleanup_destroy_yara_compiler (void *ptr) > +{ > + YR_COMPILER *compiler = * (YR_COMPILER **) ptr; > + > + if (compiler != NULL) > + yr_compiler...
2020 Mar 09
4
[PATCH v3 0/3] Switch augeas APIs to OCaml
This reimplements the augeas APIs using ocaml-augeas (dropping all the C code). The behaviour seems unchanged, although I may have not tested all the various corner cases. Changes from v2: - dropped patch #1, as it was applied already (was a real bugfix) - rebased on master Pino Toscano (3): Revert "Revert "daemon: implement OptString for OCaml APIs"" daemon: move augeas