Displaying 20 results from an estimated 68 matches for "cleanup_fclose".
2016 Sep 17
0
[PATCH 4/4] TSK: small refactoring
...tfs_h *, const char *);
static int deserialise_dirent_list (guestfs_h *, FILE *, struct guestfs_tsk_dirent_list *);
+static char *make_temp_file (guestfs_h *, const char *);
struct guestfs_tsk_dirent_list *
guestfs_impl_filesystem_walk (guestfs_h *g, const char *mountable)
{
int ret = 0;
- CLEANUP_FCLOSE FILE *fp = NULL;
CLEANUP_UNLINK_FREE char *tmpfile = NULL;
- ret = guestfs_int_lazy_make_tmpdir (g);
- if (ret < 0)
- return NULL;
-
- tmpfile = safe_asprintf (g, "%s/filesystem_walk%d", g->tmpdir, ++g->unique);
+ tmpfile = make_temp_file (g, "filesystem_walk"...
2017 Apr 25
1
Re: [PATCH v8 4/8] New API: yara_load
...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 1...
2017 Sep 12
0
[PATCH v2 2/5] lib: qemu: Factor out common code for reading and writing cache files.
.../qemu.help", cachedir);
- qemu_devices_filename = safe_asprintf (g, "%s/qemu.devices", cachedir);
-
/* Did we previously test the same version of qemu? */
debug (g, "checking for previously cached test results of %s, in %s",
g->hv, cachedir);
- {
- CLEANUP_FCLOSE FILE *fp = NULL;
- fp = fopen (qemu_stat_filename, "r");
- if (fp == NULL)
- goto do_test;
- if (fscanf (fp, "%d %" SCNu64 " %" SCNu64,
- &generation, &prev_size, &prev_mtime) != 3) {
- goto do_test;
- }
- }
-
- if (ge...
2017 Mar 12
0
[PATCH v4 3/7] New API: yara_load
...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.h
+++ b/daemon/cleanups.h
@@ -26,6 +2...
2016 Nov 09
0
[PATCH v2 2/6] New API: yara_load
...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);
}
+
+#ifdef HAVE_YARA
+
+void
+cleanu...
2017 Apr 06
0
[PATCH v6 3/7] New API: yara_load
...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.h
+++ b/daemon/cleanups.h
@@ -26,6 +2...
2017 Apr 24
0
[PATCH v8 4/8] New API: yara_load
...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.h
+++ b/daemon/cleanups.h
@@ -26,6 +2...
2017 Apr 04
0
[PATCH v5 3/7] New API: yara_load
...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.h
+++ b/daemon/cleanups.h
@@ -26,6 +2...
2016 Sep 17
7
[PATCH 0/4] New API - find_block
This series is ready for review but requires the previous one to be merged first:
https://www.redhat.com/archives/libguestfs/2016-September/msg00101.html
The find_block API allows the User to search all the filesystem entries
referring to a given data block and returns a tsk_dirent structure
for each of them.
Use case examples:
- Check whether a block containing a deleted file has been re-used
2017 Mar 06
7
[PATCH 0/6] Various Coverity fixes #2
Hi,
this patch series fixes few more issues discovered by Coverity.
Thanks,
Pino Toscano (6):
tail: check the return value pf guestfs_set_pgroup
daemon: btrfs: check end_stringsbuf return values everywhere
java: use cleanup handlers for structs (lists) as return values
lib: qemu: improve handling of FILE*
p2v: check more return values
p2v: fix possible close(-1) issue
cat/tail.c
2017 Sep 12
2
Re: [PATCH v2 2/5] lib: qemu: Factor out common code for reading and writing cache files.
...ame, R_OK) == -1) {
if (errno == ENOENT)
return 0; /* no cache, run the test instead */
perrorf (g, "access: %s", filename);
return -1;
}
> +static int
> +generic_write_cache (guestfs_h *g, const char *filename, const char *str)
> +{
> + CLEANUP_FCLOSE FILE *fp = fopen (filename, "w");
> + if (fp == NULL) {
> + perrorf (g, "%s", filename);
> + return -1;
> + }
> +
> + if (fprintf (fp, "%s", str) == -1) {
> + perrorf (g, "%s: write", filename);
> + return -1;
> + }...
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 Sep 11
4
[PATCH 0/4] lib: qemu: Add test for mandatory locking.
The patch I posted last week to disable mandatory locking for readonly
drives
(https://www.redhat.com/archives/libguestfs/2017-September/msg00013.html)
was wrong in a couple of respects. Firstly it didn't work, which I
didn't detect because my tests were testing the wrong thing. Oops.
Secondly it used a simple version number check to detect qemu binaries
implementing mandatory locking.
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
2017 Sep 12
9
[PATCH v2 0/5] launch: direct: Disable qemu locking when opening drives readonly (RHBZ#1417306)
Patches 1-4 are almost the same as they are when previously posted
here:
https://www.redhat.com/archives/libguestfs/2017-September/msg00039.html
Patch 5 actually uses the mandatory locking test to turn off locking
in the narrow case where a drive is opened readonly, and then only for
the drive being inspected.
Passes ordinary tests (‘check-direct’ and ‘check-valgrind-direct’).
Rich.
2020 Feb 18
2
[PATCH] make-fs: Don't use du --apparent-size to estimate input size.
...85..386142280 100644
--- a/make-fs/make-fs.c
+++ b/make-fs/make-fs.c
@@ -393,7 +393,7 @@ static int
estimate_input (const char *input, uint64_t *estimate_rtn, char **ifmt_rtn)
{
struct stat statbuf;
- const char *argv[6];
+ const char *argv[5];
CLEANUP_UNLINK_FREE char *tmpfile = NULL;
CLEANUP_FCLOSE FILE *fp = NULL;
char line[256];
@@ -424,11 +424,10 @@ estimate_input (const char *input, uint64_t *estimate_rtn, char **ifmt_rtn)
}
argv[0] = "du";
- argv[1] = "--apparent-size";
- argv[2] = "-b";
- argv[3] = "-s";
- argv[4] = inpu...
2015 May 14
1
[PATCH] When calling getline first time, initialize length to zero.
...lush (stdout)
FILE *fp;
char *line = NULL;
- size_t len;
+ size_t len = 0;
struct stat statbuf;
char buf[128];
ssize_t r;
diff --git a/p2v/main.c b/p2v/main.c
index 15628ba..1f8370b 100644
--- a/p2v/main.c
+++ b/p2v/main.c
@@ -306,7 +306,7 @@ partition_parent (dev_t part_dev)
{
CLEANUP_FCLOSE FILE *fp = NULL;
CLEANUP_FREE char *path = NULL, *content = NULL;
- size_t len;
+ size_t len = 0;
unsigned parent_major, parent_minor;
if (asprintf (&path, "/sys/dev/block/%d:%d/../dev",
@@ -521,7 +521,7 @@ read_cmdline (void)
{
CLEANUP_FCLOSE FILE *fp = NULL;
char...
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: yara_destroy
New API: internal_yara_scan
New API: yara_scan
yara_scan: added AP...
2017 Jun 19
0
[PATCH v7 13/13] daemon: Link guestfsd with libutils.
...(* (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 (void *ptr)
aug_close (aug);
}
-struct stringsbuf;
-extern void free_stringsbuf (struct stringsbuf *sb);
-...
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