Displaying 20 results from an estimated 125 matches for "safe_malloc".
2017 Feb 14
2
[PATCH 1/2] GCC 7: Add __attribute__((noreturn)) to some usage functions which call exit.
This happens with GCC 7.0.1. The errors were all of the form:
qemu-speed-test.c: In function 'main':
qemu-speed-test.c:153:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
usage (EXIT_SUCCESS);
^~~~~~~~~~~~~~~~~~~~
qemu-speed-test.c:155:5: note: here
default:
^~~~~~~
---
builder/index-validate.c | 2 +-
2017 Feb 14
0
[PATCH 2/2] GCC 7: Allocate sufficient space for sprintf output.
...iff --git a/generator/bindtests.ml b/generator/bindtests.ml
index 22d0c37..2fde425 100644
--- a/generator/bindtests.ml
+++ b/generator/bindtests.ml
@@ -258,8 +258,8 @@ fill_lvm_pv (guestfs_h *g, struct guestfs_lvm_pv *pv, size_t i)
pr " }\n";
pr " strs = safe_malloc (g, (n+1) * sizeof (char *));\n";
pr " for (i = 0; i < n; ++i) {\n";
- pr " strs[i] = safe_malloc (g, 16);\n";
- pr " snprintf (strs[i], 16, \"%%zu\", i);\n";
+ pr " strs[i] = safe_mallo...
2017 May 04
0
Re: [PATCH v1 1/2] appliance: search all types of appliances for each path separately
...efs hide the meaning of
the code, so it becomes unclear what we are passing around as a
parameter. Attached is a patch which turns this into a simple struct.
> + r = contains_fixed_appliance (g, path, NULL);
> if (r == 1) {
> const size_t len = strlen (path);
> - *kernel = safe_malloc (g, len + 6 /* "kernel" */ + 2);
> - *initrd = safe_malloc (g, len + 6 /* "initrd" */ + 2);
> - *appliance = safe_malloc (g, len + 4 /* "root" */ + 2);
> - sprintf (*kernel, "%s/kernel", path);
> - sprintf (*initrd, "%s/initrd&quo...
2017 Feb 14
0
[PATCH v2 2/2] GCC 7: Allocate sufficient space for sprintf output.
...uestfs_protocol.h\"
+#include \"intprops.h\"
+
int
guestfs_impl_internal_test_set_output (guestfs_h *g, const char *filename)
{
@@ -258,8 +260,8 @@ fill_lvm_pv (guestfs_h *g, struct guestfs_lvm_pv *pv, size_t i)
pr " }\n";
pr " strs = safe_malloc (g, (n+1) * sizeof (char *));\n";
pr " for (i = 0; i < n; ++i) {\n";
- pr " strs[i] = safe_malloc (g, 16);\n";
- pr " snprintf (strs[i], 16, \"%%zu\", i);\n";
+ pr " strs[i] = safe_mallo...
2017 Feb 14
4
[PATCH v2 0/2] GCC 7: Misc fixes
v1 -> v2:
- Use intprops macro suggested by danpb.
Rich.
2009 Nov 18
1
[PATCH] generator: Fix API of functions that return RBufferOut
..."0"; "100"]], "")],
"read part of a file",
"\
This command lets you read part of a file. It reads C<count>
@@ -5107,7 +5109,7 @@ and generate_client_actions () =
#define error guestfs_error
//#define perrorf guestfs_perrorf
-//#define safe_malloc guestfs_safe_malloc
+#define safe_malloc guestfs_safe_malloc
#define safe_realloc guestfs_safe_realloc
//#define safe_strdup guestfs_safe_strdup
#define safe_memdup guestfs_safe_memdup
@@ -5396,8 +5398,20 @@ check_state (guestfs_h *g, const char *caller)
pr " /* caller will fre...
2016 Feb 05
7
[PATCH 0/7] lib: Stop exporting the safe_malloc, etc. functions.
The safe_malloc (etc) functions call g->abort_fn on failure. That's
not appropriate for language bindings, and we never intended that
these internal functions be used from language bindings, that was just
a historical accident.
This patch series removes any external use of the safe_* functions.
Rich.
2009 Nov 19
1
[PATCH libguestfs] syntax-check: expand TABs in generator.ml
...(ret.%s.%s_len > 0) {\n" n n;
pr " *size_r = ret.%s.%s_len;\n" n n;
pr " return ret.%s.%s_val; /* caller will free */\n" n n;
- pr " } else {\n";
- pr " free (ret.%s.%s_val);\n" n n;
- pr " char *p = safe_malloc (g, 1);\n";
+ pr " } else {\n";
+ pr " free (ret.%s.%s_val);\n" n n;
+ pr " char *p = safe_malloc (g, 1);\n";
pr " *size_r = ret.%s.%s_len;\n" n n;
pr " return p;\n";
- pr &q...
2014 Nov 16
2
[PATCH] list-applications: Add support for pacman
...path_len = strlen ("/var/lib/pacman/local/") + strlen ("/desc");
+ struct guestfs_dirent_list *local_db = NULL;
+
+ local_db = guestfs_readdir (g, "/var/lib/pacman/local");
+ if (local_db == NULL)
+ return NULL;
+
+ /* Allocate 'apps' list. */
+ apps = safe_malloc (g, sizeof *apps);
+ apps->len = 0;
+ apps->val = NULL;
+
+
+ for (i = 0; i < local_db->len; i++) {
+ curr = &local_db->val[i];
+
+ if (curr->ftyp != 'd' || STREQ (curr->name, ".") || STREQ (curr->name, ".."))
+ continue;
+
+...
2013 Sep 06
1
[PATCH] arm: appliance: Add support for device trees (dtb's).
This is the libguestfs companion patch to:
https://www.redhat.com/archives/libguestfs/2013-September/msg00045.html
Rich.
2016 Apr 04
2
Re: [PATCH v2 4/5] appliance: Added filesystem_walk command
...success, NULL on error.
> + */
> +static struct guestfs_tsk_dirent_list *
> +parse_filesystem_walk (guestfs_h *g, char *buf, size_t bufsize)
> +{
> + int ret = 0;
> + struct guestfs_tsk_dirent_list *dirents = NULL;
> +
> + /* Initialise results array. */
> + dirents = safe_malloc (g, sizeof (struct guestfs_tsk_dirent_list));
> + dirents->len = 8;
> + dirents->val = safe_malloc (g, dirents->len *
> + sizeof (struct guestfs_tsk_dirent));
sizeof (*dirents->val) (and below too) can make the code slightly
shorter (just an hint...
2016 Apr 03
0
[PATCH v2 4/5] appliance: Added filesystem_walk command
...nts list.
+ * Return a list of tsk_dirent on success, NULL on error.
+ */
+static struct guestfs_tsk_dirent_list *
+parse_filesystem_walk (guestfs_h *g, char *buf, size_t bufsize)
+{
+ int ret = 0;
+ struct guestfs_tsk_dirent_list *dirents = NULL;
+
+ /* Initialise results array. */
+ dirents = safe_malloc (g, sizeof (struct guestfs_tsk_dirent_list));
+ dirents->len = 8;
+ dirents->val = safe_malloc (g, dirents->len *
+ sizeof (struct guestfs_tsk_dirent));
+
+ /* Deserialise buffer into dirent list. */
+ ret = deserialise_dirent_list (g, buf, bufsize, &di...
2010 Jul 05
5
[PATCH 0/3] RFC: Allow use of external QEMU process with libguestfs
This attempts to implement the idea proposed in
https://www.redhat.com/archives/libguestfs/2010-April/msg00087.html
The idea is that an externally managed QEMU (manual, or via libvirt)
can boot the appliance kernel/initrd. libguestfs can then be just told
of the UNIX domain socket associated with the guest daemon.
An example based on guestfish.
1. Step one, find the appliance kernel/initrd
2015 Mar 16
0
[PATCH] inspection: add support for systemd .mount files
...;, NULL};
+ const char **dir;
+ for (dir = dirs; *dir != NULL; dir++) {
+ CLEANUP_FREE_STRING_LIST char **entries = NULL;
+ char **entry;
+
+ entries = guestfs_find (g, *dir);
+ size_t cnt = guestfs_int_count_strings (entries);
+
+ CLEANUP_FREE_STRING_LIST char **filenames =
+ safe_malloc (g, (cnt + 1) * sizeof (char *));
+
+ size_t idx = 0;
+ for (entry = entries; *entry != NULL; entry++) {
+ if (STRSUFFIX (*entry, ".mount")) {
+ size_t entry_len = strlen(*dir) + strlen(*entry) + 1;
+ filenames[idx] = safe_malloc (g, entry_len);
+ snprintf...
2015 Mar 16
2
[PATCH] RFE: Inspection should support systemd mount units
Adds support for systemd .mount files, uses Augeas to extract mount points.
Fixes RHBZ#1113153.
Maros Zatko (1):
inspection: add support for systemd .mount files
src/inspect-fs-unix.c | 240 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 240 insertions(+)
--
1.9.3
2016 Apr 05
1
Re: [PATCH v3 4/5] appliance: Added filesystem_walk command
...success, NULL on error.
> + */
> +static struct guestfs_tsk_dirent_list *
> +parse_filesystem_walk (guestfs_h *g, char *buf, size_t bufsize)
> +{
> + int ret = 0;
> + struct guestfs_tsk_dirent_list *dirents = NULL;
> +
> + /* Initialise results array. */
> + dirents = safe_malloc (g, sizeof (*dirents));
> + dirents->len = 8;
> + dirents->val = safe_malloc (g, dirents->len * sizeof (*dirents->val));
> +
> + /* Deserialise buffer into dirent list. */
> + ret = deserialise_dirent_list (g, buf, bufsize, dirents);
> + if (ret < 0) {
> +...
2014 Nov 17
1
[PATCH] list-applications: Add support for pacman
...er = NULL, *p;
+ int32_t epoch;
+ const size_t path_len = strlen ("/var/lib/pacman/local/") + strlen ("/desc");
+
+ local_db = guestfs_readdir (g, "/var/lib/pacman/local");
+ if (local_db == NULL)
+ return NULL;
+
+ /* Allocate 'apps' list. */
+ apps = safe_malloc (g, sizeof *apps);
+ apps->len = 0;
+ apps->val = NULL;
+
+ for (i = 0; i < local_db->len; i++) {
+ curr = &local_db->val[i];
+
+ if (curr->ftyp != 'd' || STREQ (curr->name, ".") || STREQ (curr->name, ".."))
+ continue;
+
+ fr...
2014 Nov 16
0
Re: [PATCH] list-applications: Add support for pacman
...n/local/") + strlen ("/desc");
> + struct guestfs_dirent_list *local_db = NULL;
> +
> + local_db = guestfs_readdir (g, "/var/lib/pacman/local");
> + if (local_db == NULL)
> + return NULL;
> +
> + /* Allocate 'apps' list. */
> + apps = safe_malloc (g, sizeof *apps);
> + apps->len = 0;
> + apps->val = NULL;
> +
> +
Extra blank line here.
> + for (i = 0; i < local_db->len; i++) {
> + curr = &local_db->val[i];
> +
> + if (curr->ftyp != 'd' || STREQ (curr->name, ".") |...
2016 Mar 29
3
[PATCH 0/2] added filesystem_walk API
The filesystem_walk API parses the FS internals of a partition and returns a list of all the files and directories contained within. It list deleted files and directories as well.
For each node, it reports its relative path, its inode and its allocation status.
This is the end user API for inspecting a disk partition content.
The command can handle filenames with special characters.
Example
2016 Nov 09
0
[PATCH v2 5/6] New API: yara_scan
...{
+ int ret = 0;
+ CLEANUP_FCLOSE FILE *fp = NULL;
+ struct guestfs_yara_detection_list *detections = NULL;
+
+ fp = fopen (tmpfile, "r");
+ if (fp == NULL) {
+ perrorf (g, "fopen: %s", tmpfile);
+ return NULL;
+ }
+
+ /* Initialise results array. */
+ detections = safe_malloc (g, sizeof (*detections));
+ detections->len = 8;
+ detections->val = safe_malloc (g, detections->len *
+ sizeof (*detections->val));
+
+ /* Deserialise buffer into detection list. */
+ ret = deserialise_yara_detection_list (g, fp, detections);
+ if...