Displaying 20 results from an estimated 28 matches for "free_stringsbuf".
2015 Jun 17
4
[PATCH 1/4] daemon: introduce free_stringsbuf
...-- 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 char *fs, ...)
__attribute__((format (printf,2,3)));
extern int end_stringsbuf (struct stringsbuf *sb);
+extern void free_stringsbuf (struct stringsbuf *sb);
extern size_t count_strings (char *const *argv);
extern void sort_strings (char **argv, size_t len);
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index c912ee3..453dee1 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -587,6 +587,13 @@ end_stringsbuf (str...
2015 Jun 17
0
[PATCH 4/4] daemon: add split_lines_sb
...return value, as the stringsbuf will be
+ * returned as it is anyway.
+ */
+ end_stringsbuf (&lines);
+ return lines;
+ }
p = str;
while (p) {
@@ -1155,16 +1164,26 @@ split_lines (char *str)
}
if (add_string (&lines, p) == -1) {
- return NULL;
+ free_stringsbuf (&lines);
+ return null;
}
p = pend;
}
- if (end_stringsbuf (&lines) == -1)
- return NULL;
+ if (end_stringsbuf (&lines) == -1) {
+ free_stringsbuf (&lines);
+ return null;
+ }
+
+ return lines;
+}
- return lines.argv;
+char **
+split_lines (cha...
2020 Mar 12
8
[PATCH libguestfs 0/3] daemon: Fix various commands which break on NTFS-3g compressed files.
https://bugzilla.redhat.com/show_bug.cgi?id=1811539
Commands including virt-diff which read extended attributes will
sometimes fail on NTFS filesystems that are using system compressed.
The reason is complex, see comment 5 of the bug linked above.
This patch filters out the troublesome xattr. For justification, see
the comment I added in patch 3.
Patch 1 & 2 are refactoring.
I was on the
2020 Mar 12
0
[PATCH libguestfs 1/3] daemon: xattr: Refactor code which splits attr names from the kernel.
...gs.
+ *
+ * Note the caller must free the returned string list.
+ */
+static char **
+split_attr_names (const char *buf, size_t len)
+{
+ size_t i;
+ DECLARE_STRINGSBUF (ret);
+
+ for (i = 0; i < len; i += strlen (&buf[i]) + 1) {
+ if (add_string (&ret, &buf[i]) == -1) {
+ free_stringsbuf (&ret);
+ return NULL;
+ }
+ }
+ if (end_stringsbuf (&ret) == -1) {
+ free_stringsbuf (&ret);
+ return NULL;
+ }
+
+ return take_stringsbuf (&ret);
+}
+
static int
compare_xattrs (const void *vxa1, const void *vxa2)
{
@@ -106,7 +135,8 @@ getxattrs (const char *p...
2016 Nov 21
2
Re: [PATCH v2 2/6] New API: yara_load
...> 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 12
0
[PATCH libguestfs 2/3] daemon: Add filter_list utility function.
...ts of strings based on a predicate.
---
daemon/daemon.h | 1 +
daemon/utils.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/daemon/daemon.h b/daemon/daemon.h
index 4d7504b3f..a16953f23 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -74,6 +74,7 @@ extern void free_stringsbuf (struct stringsbuf *sb);
extern struct stringsbuf split_lines_sb (char *str);
extern char **split_lines (char *str);
extern char **empty_list (void);
+extern char **filter_list (int (*p) (const char *), char **strs);
extern int is_power_of_2 (unsigned long v);
extern void trim (char *str);
ex...
2020 Mar 16
0
[PATCH libguestfs v2 2/3] daemon: Add filter_list utility function.
...n/daemon.h
index 4d7504b3f..9a5ac6d42 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
+#include <stdbool.h>
#include <errno.h>
#include <unistd.h>
@@ -74,6 +75,7 @@ extern void free_stringsbuf (struct stringsbuf *sb);
extern struct stringsbuf split_lines_sb (char *str);
extern char **split_lines (char *str);
extern char **empty_list (void);
+extern char **filter_list (bool (*p) (const char *), char **strs);
extern int is_power_of_2 (unsigned long v);
extern void trim (char *str);
e...
2016 Nov 22
0
Re: [PATCH v2 2/6] New API: yara_load
...>
>> 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;
>> +
>...
2017 Jun 19
0
[PATCH v7 13/13] daemon: Link guestfsd with libutils.
...- 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);
-
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...
2016 Nov 09
0
[PATCH v2 2/6] New API: yara_load
...NUP_* 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/...
2016 Jan 21
0
[PATCH v3 2/6] daemon: Split out command() functions and CLEANUP_* macros into separate files.
...e);
+ 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
+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 gues...
2020 Mar 16
6
[PATCH libguestfs v2 0/3] daemon: Fix various commands which break on NTFS-3g compressed files.
v1 here:
https://www.redhat.com/archives/libguestfs/2020-March/msg00099.html
This one fixes most of the points picked up in review, and does not
strdup the strings which should keep down memory usage if that is a
concern.
Rich.
2017 Aug 03
9
[PATCH 0/6] tests: Fix handling of device API parameters (RHBZ#1477623).
https://bugzilla.redhat.com/show_bug.cgi?id=1477623
The first two patches are cleanups.
The third patch changes the way that we handle Device and Dev_or_Path
parameters so that a parameter marked as such can really only contain
a block device name (and not, for instance, a chardev). Using a
chardev here caused hangs in the API.
The next two patches fix API usage to conform to this new stricter
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 Jul 14
0
[PATCH 05/27] daemon: Reimplement several devsparts APIs in OCaml.
...s.mli
@@ -268,6 +269,7 @@ SOURCES_ML = \
mountable.ml \
chroot.ml \
blkid.ml \
+ devsparts.ml \
file.ml \
callbacks.ml \
daemon.ml
diff --git a/daemon/daemon.h b/daemon/daemon.h
index be7a3bedc..0a92e6cee 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -130,9 +130,6 @@ extern void free_stringsbuf (struct stringsbuf *sb);
extern void sort_strings (char **argv, size_t len);
extern void free_stringslen (char **argv, size_t len);
-extern void sort_device_names (char **argv, size_t len);
-extern int compare_device_names (const char *a, const char *b);
-
extern struct stringsbuf split_lines_...
2015 Dec 05
6
[PATCH 0/6 v2] [FOR COMMENTS ONLY] Rework inspection.
This is a more working version. Inspection (partially) succeeds on a
real guest this time :-)
You can test it out on a real guest (in this case, a CentOS disk image
located at /tmp/centos-6.img) by doing:
$ ./run guestfish -v -x -a /tmp/centos-6.img
><fs> run
><fs> debug sh "guestfs-inspection --verbose"
which will print lots of debugging, and at the end the
2016 Jan 21
8
[PATCH v3 0/6] [FOR COMMENTS ONLY] Rework inspection.
For background on this change, see:
https://rwmj.wordpress.com/2015/12/06/inspection-now-with-added-prolog/
v2 was previously posted here:
https://www.redhat.com/archives/libguestfs/2015-December/msg00038.html
To test this patch series on a real guest, you can do:
$ ./run guestfish -v -x -a /var/tmp/centos-6.img
><fs> run
><fs> debug sh "guestfs-inspection
2016 Feb 23
4
[PATCH v3 0/4] [FOR COMMENTS ONLY] Rework inspection.
Previously posted:
https://www.redhat.com/archives/libguestfs/2015-December/msg00038.html
Inspection now really succeeds on a small number of simple guests.
To test it out:
$ ./run guestfish -v -x -a /tmp/centos-6.img
><fs> run
><fs> debug sh "guestfs-inspection --verbose"
Rich.
2017 Jul 24
6
[PATCH 0/2] daemon: Replace GUESTFSD_EXT_CMD with --print-external-commands.
Replace GUESTFSD_EXT_CMD with a command line option
‘./guestfsd --print-external-commands’
2017 Jun 09
12
[PATCH 00/12] Refactor utility functions.
This turned out to be rather more involved than I thought.
We have lots of utility functions, spread all over the repository,
with not a lot of structure. This moves many of them under common/
and structures them so there are clear dependencies.
This doesn't complete the job by any means. Other items I had on my
to-do list for this change were:
- Split up mllib/common_utils into:
-