search for: cleanup_close

Displaying 20 results from an estimated 42 matches for "cleanup_close".

Did you mean: cleanup_fclose
2014 Aug 08
3
[PATCH] daemon: add CLEANUP_CLOSE
...on.h index fb74e91..0caad45 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -173,6 +173,7 @@ asprintf_nowarn (char **strp, const char *fmt, ...) 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); /*-- in names.c (auto-generated) --*/ extern const char *function_names[]; @@ -405,10 +406,12 @@ is_zero (const char *buffer, size_t size) #define CLEANUP_FREE_STRING_LIST \ __attribute__((cleanup(cleanup_free_string_list))) #define CLEANUP_UNLINK_FREE...
2017 Mar 12
0
[PATCH v4 3/7] New API: yara_load
...on/Makefile.am +++ b/daemon/Makefile.am @@ -164,6 +164,7 @@ guestfsd_SOURCES = \ wc.c \ xattr.c \ xfs.c \ + yara.c \ zero.c \ zerofree.c diff --git a/daemon/cleanups.c b/daemon/cleanups.c index 092e493d7..3102cf94b 100644 --- a/daemon/cleanups.c +++ b/daemon/cleanups.c @@ -62,6 +62,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; diff --git a/daemon/cleanups.h b/daemon/cleanups.h index 6746e2744..a791244cb 100644 --- a/daemon/cleanups...
2016 Nov 09
0
[PATCH v2 2/6] New API: yara_load
...100644 --- a/daemon/cleanups.c +++ b/daemon/cleanups.c @@ -24,6 +24,12 @@ #include <augeas.h> +#ifdef HAVE_YARA + +#include <yara.h> + +#endif /* !HAVE_YARA */ + #include "cleanups.h" /* Use by 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);...
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
2017 Apr 25
1
Re: [PATCH v8 4/8] New API: yara_load
...guestfsd_SOURCES = \ > wc.c \ > xattr.c \ > xfs.c \ > + yara.c \ > zero.c \ > zerofree.c > > diff --git a/daemon/cleanups.c b/daemon/cleanups.c > index 092e493d7..3102cf94b 100644 > --- a/daemon/cleanups.c > +++ b/daemon/cleanups.c > @@ -62,6 +62,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; > diff --git a/daemon/cleanu...
2017 Apr 06
0
[PATCH v6 3/7] New API: yara_load
...on/Makefile.am +++ b/daemon/Makefile.am @@ -168,6 +168,7 @@ guestfsd_SOURCES = \ wc.c \ xattr.c \ xfs.c \ + yara.c \ zero.c \ zerofree.c diff --git a/daemon/cleanups.c b/daemon/cleanups.c index 092e493d7..3102cf94b 100644 --- a/daemon/cleanups.c +++ b/daemon/cleanups.c @@ -62,6 +62,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; diff --git a/daemon/cleanups.h b/daemon/cleanups.h index 6746e2744..a791244cb 100644 --- a/daemon/cleanups...
2017 Apr 24
0
[PATCH v8 4/8] New API: yara_load
...on/Makefile.am +++ b/daemon/Makefile.am @@ -170,6 +170,7 @@ guestfsd_SOURCES = \ wc.c \ xattr.c \ xfs.c \ + yara.c \ zero.c \ zerofree.c diff --git a/daemon/cleanups.c b/daemon/cleanups.c index 092e493d7..3102cf94b 100644 --- a/daemon/cleanups.c +++ b/daemon/cleanups.c @@ -62,6 +62,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; diff --git a/daemon/cleanups.h b/daemon/cleanups.h index 6746e2744..a791244cb 100644 --- a/daemon/cleanups...
2017 Apr 04
0
[PATCH v5 3/7] New API: yara_load
...on/Makefile.am +++ b/daemon/Makefile.am @@ -168,6 +168,7 @@ guestfsd_SOURCES = \ wc.c \ xattr.c \ xfs.c \ + yara.c \ zero.c \ zerofree.c diff --git a/daemon/cleanups.c b/daemon/cleanups.c index 092e493d7..3102cf94b 100644 --- a/daemon/cleanups.c +++ b/daemon/cleanups.c @@ -62,6 +62,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; diff --git a/daemon/cleanups.h b/daemon/cleanups.h index 6746e2744..a791244cb 100644 --- a/daemon/cleanups...
2014 Sep 04
10
[PATCH 0/5] use augeas for /etc/shadow
Hi, currently /etc/shadow is edited manually when needed (i.e. when setting the password for an user), and it is not changed when removing users. Import the upstream shadow.aug (currently in their development serie, but not part of any released version yet), and use it only when the augeas version is less than a potential 1.2.1 (covering also the case when the new version is just 1.3.0). Pino
2016 Jan 21
0
[PATCH v3 2/6] daemon: Split out command() functions and CLEANUP_* macros into separate files.
...+} + +extern void free_strings (char **argv); + +void +cleanup_free_string_list (void *ptr) +{ + free_strings (* (char ***) ptr); +} + +void +cleanup_unlink_free (void *ptr) +{ + char *filename = * (char **) ptr; + + if (filename) { + unlink (filename); + free (filename); + } +} + +void +cleanup_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 +cleanu...
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 Jun 19
0
[PATCH v7 13/13] daemon: Link guestfsd with libutils.
...-} - -extern void free_strings (char **argv); - -void -cleanup_free_string_list (void *ptr) -{ - free_strings (* (char ***) ptr); -} - -void -cleanup_unlink_free (void *ptr) -{ - char *filename = * (char **) ptr; - - if (filename) { - unlink (filename); - free (filename); - } -} - -void -cleanup_close (void *ptr) -{ - const int fd = * (int *) ptr; - - if (fd >= 0) - close (fd); -} - -void -cleanup_fclose (void *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 (vo...
2016 Nov 22
2
Re: [PATCH v2 4/6] New API: internal_yara_scan
...fo (const char *, YR_RULE *); > > /* Has one FileIn parameter. */ > int > @@ -107,6 +109,39 @@ do_yara_destroy (void) > return 0; > } > > +/* Has one FileOut parameter. */ > +int > +do_internal_yara_scan (const char *path) > +{ > + int ret = 0; > + CLEANUP_CLOSE int fd = 0; This must be initialized as -1, otherwise the CLEANUP_CLOSE handler will close the fd 0, which is stdin of the daemon. > + > + if (rules == NULL) { > + reply_with_error ("no yara rules loaded"); > + return -1; > + } > + > + CHROOT_IN; > + fd...
2017 Aug 08
1
Re: [PATCH 3/6] daemon: Refine check for Device and Dev_or_Path parameters (RHBZ#1477623).
...(fd, BLKGETSIZE64, &n) == -1) { > + if (verbose) > + fprintf (stderr, "%s: ioctl BLKGETSIZE64: %s: %m\n", > + "is_device_parameter", device); > + close (fd); > + return 0; > + } > + close (fd); Maybe 'fd' can be: CLEANUP_CLOSE int fd = -1; so there is no need to manually close() it on every return path. -- Pino Toscano
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:
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 Dec 18
6
[PATCH v3 0/6] Feature: Yara file scanning
v3: - allow to load multiple rule files - added optional namespace parameter to yara_load - move destructor logic in yara module - use generic file upload logic - use generic temporary path function Matteo Cafasso (6): 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
2016 Nov 22
0
Re: [PATCH v2 4/6] New API: internal_yara_scan
...s one FileIn parameter. */ >> int >> @@ -107,6 +109,39 @@ do_yara_destroy (void) >> return 0; >> } >> >> +/* Has one FileOut parameter. */ >> +int >> +do_internal_yara_scan (const char *path) >> +{ >> + int ret = 0; >> + CLEANUP_CLOSE int fd = 0; > This must be initialized as -1, otherwise the CLEANUP_CLOSE handler > will close the fd 0, which is stdin of the daemon. > >> + >> + if (rules == NULL) { >> + reply_with_error ("no yara rules loaded"); >> + return -1; >> + } &gt...
2017 Feb 19
9
[PATCH v3 0/7] Feature: Yara file scanning
Rebase patches on top of 1.35.25. 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 Apr 25
8
[PATCH v9 0/7] Feature: Yara file scanning
v9: - fixes according to comments 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 | 4 +-