search for: len_rtn

Displaying 20 results from an estimated 45 matches for "len_rtn".

2017 Mar 03
1
Re: [PATCH 08/11] ocaml: do not try to malloc 0 elements in get_all_event_callbacks
...hat size. POSIX says that this can result in either a null pointer, > or an unusable pointer. Since we assume a null pointer means failure, > then always add a null element at the end, so we do not rely on > implementation-defined behaviour of malloc. > > The output parameter 'len_rtn' already keeps the number of valid items > in the returned array, so there are no behaviour changes for callers of > get_all_event_callbacks. > --- > ocaml/guestfs-c.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/ocaml/guestfs-c.c b/ocaml/gue...
2017 Mar 03
14
[PATCH 00/11] Various Coverity fixes
Hi, this patch series fixes some issues discovered by Coverity. Most of them are memory leaks, usually on error; there are also invalid memory access issues. Thanks, Pino Toscano (11): java: link libguestfs_jni against libutils java: fix invalid memory access for FBuffer in struct lists daemon: tsk: properly use GUESTFS_MAX_CHUNK_SIZE edit: fix small memory leak on error java: fix
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.
2017 Mar 03
5
[PATCH v2 0/4] Avoid 0-bytes malloc in bindings
Hi, some of the bindings may try to malloc with 0 bytes as size when closing an handle, because there were no event handlers registered. Since this can have different behaviours in POSIX, avoid that situation altogether by just skipping allocating anything when there were no event handlers. Thanks, Pino Toscano (4): ocaml: do not try to malloc 0 elements in get_all_event_callbacks python:
2013 Jun 25
2
Re: [PATCH] Add read support for "big data" blocks to hivex
* Richard W.M. Jones: > diff --git a/lib/hivex.c b/lib/hivex.c > index e3c1e05..9351ac5 100644 > --- a/lib/hivex.c > +++ b/lib/hivex.c > @@ -1471,7 +1471,7 @@ hivex_value_value (hive_h *h, hive_value_h value, > if (h->msglvl >= 2) > fprintf (stderr, "hivex_value_value: warning: big data block is not " > "valid
2017 Mar 03
0
[PATCH 08/11] ocaml: do not try to malloc 0 elements in get_all_event_callbacks
...g to malloc a buffer of that size. POSIX says that this can result in either a null pointer, or an unusable pointer. Since we assume a null pointer means failure, then always add a null element at the end, so we do not rely on implementation-defined behaviour of malloc. The output parameter 'len_rtn' already keeps the number of valid items in the returned array, so there are no behaviour changes for callers of get_all_event_callbacks. --- ocaml/guestfs-c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c index 9042752..f14eee3 100...
2013 Jun 25
0
[PATCH] Add read support for "big data" blocks to hivex
...rning: declared data length " - "is longer than the block it is in " - "(data 0x%zx, data len %zu, block len %zu)\n", - data_offset, len, blen); - len = blen - 4; - - /* Return the smaller length to the caller too. */ - if (len_rtn) - *len_rtn = len; + if (len <= blen - 4 /* subtract 4 for block header */) { + char *data = (char *) h->addr + data_offset + 4; + memcpy (ret, data, len); + return ret; + } else { + if (!IS_VALID_BLOCK (h, data_offset) || !BLOCK_ID_EQ (h, data_offset, "db")) { +...
2017 May 11
1
[PATCH] python: improve few exceptions thrown on error
...(PyObject *self, PyObject *args) str = guestfs_event_to_string (events); if (str == NULL) { - PyErr_SetString (PyExc_RuntimeError, strerror (errno)); + PyErr_SetFromErrno (PyExc_RuntimeError); return NULL; } @@ -271,7 +271,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn) /* Copy them into the return array. */ r = malloc (sizeof (PyObject *) * (*len_rtn)); if (r == NULL) { - PyErr_SetNone (PyExc_MemoryError); + PyErr_NoMemory (); return NULL; } @@ -298,7 +298,7 @@ guestfs_int_py_get_string_list (PyObject *obj) assert (obj); if (!PyL...
2014 May 27
2
[PATCH] ruby: add :nodoc: comment for internal methods
...s way they are ignored by rdoc. --- generator/ruby.ml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/generator/ruby.ml b/generator/ruby.ml index 1111993..88762ca 100644 --- a/generator/ruby.ml +++ b/generator/ruby.ml @@ -522,6 +522,15 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn) * +guestfs_%s+[http://libguestfs.org/guestfs.3.html#guestfs_%s]). */ " f.name args ret f.shortdesc doc f.name f.name + ) else ( + pr "\ +/* + * call-seq: + * g.%s + * + * :nodoc: + */ +" f.name ); (* Generate the function. Prototype is completely...
2015 Mar 05
0
[PATCH v3] fish: add journal-view command
...ted, so you have to print it using "%.*s". - * - * There may be multiple fields with the same name. In this case, the - * function returns the first entry. - */ -static const char * -get_journal_field (const struct guestfs_xattr_list *xattrs, const char *name, - size_t *len_rtn) -{ - uint32_t i; - - for (i = 0; i < xattrs->len; ++i) { - if (STREQ (name, xattrs->val[i].attrname)) { - *len_rtn = xattrs->val[i].attrval_len; - return xattrs->val[i].attrval; - } - } - - return NULL; /* not found */ -} - -static const char *co...
2015 Mar 03
2
[PATCH v2] RFE: journal reader in guestfish
This implements new guestfish only command called journal-view. There seems to be a minor issue when user wants to run it through pager (more) and wants cancel it. User will end up with stuck guestfish until journal-view transfers all journal items. Output is now configurable, it's the same format as virt-log has, since both uses same code now. Maros Zatko (1): fish: add journal-view
2015 Mar 05
2
[PATCH v3] RFE: journal reader in guestfish
There seems to be a minor issue when user wants to run it through pager (more) and wants cancel it. User will end up with stuck guestfish until journal-view transfers all journal items. Output is now configurable, it's the same format as virt-log has, since both uses same code now. Maros Zatko (1): fish: add journal-view command cat/Makefile.am | 1 + cat/log.c | 113
2015 Oct 02
1
[PATCH] ruby: improve rdoc markup
...ibguestfs.org/guestfs.3.html#guestfs_event_to_string] + * {guestfs_event_to_string}[http://libguestfs.org/guestfs.3.html#guestfs_event_to_string] * to convert an event or event bitmask into a printable string. */ static VALUE @@ -477,13 +477,18 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn) if f.protocol_limit_warning then doc ^ "\n\n" ^ protocol_limit_warning else doc in - let doc = - match deprecation_notice f with - | None -> doc - | Some txt -> doc ^ "\n\n" ^ txt in let doc = p...
2015 Aug 31
0
[PATCH v5 1/2] cat: move get_journal_field to fish/journal.c
...ted, so you have to print it using "%.*s". - * - * There may be multiple fields with the same name. In this case, the - * function returns the first entry. - */ -static const char * -get_journal_field (const struct guestfs_xattr_list *xattrs, const char *name, - size_t *len_rtn) -{ - uint32_t i; - - for (i = 0; i < xattrs->len; ++i) { - if (STREQ (name, xattrs->val[i].attrname)) { - *len_rtn = xattrs->val[i].attrval_len; - return xattrs->val[i].attrval; - } - } - - return NULL; /* not found */ -} - -static const char *co...
2015 Aug 27
0
[PATCH v4 1/2] cat: move get_journal_field to fish/journal.c
...ted, so you have to print it using "%.*s". - * - * There may be multiple fields with the same name. In this case, the - * function returns the first entry. - */ -static const char * -get_journal_field (const struct guestfs_xattr_list *xattrs, const char *name, - size_t *len_rtn) -{ - uint32_t i; - - for (i = 0; i < xattrs->len; ++i) { - if (STREQ (name, xattrs->val[i].attrname)) { - *len_rtn = xattrs->val[i].attrval_len; - return xattrs->val[i].attrval; - } - } - - return NULL; /* not found */ -} - -static const char *co...
2015 Aug 27
4
[PATCH v4 0/2] RFE: journal reader in guestfish
There seems to be a minor issue when user wants to run it through pager (more) and wants cancel it. User will end up with stuck guestfish until journal-view transfers all journal items. Output is configurable, it's the same format as virt-log has, since both uses same code. Maros Zatko (2): cat: move get_journal_field to fish/journal.c fish: add journal-view command cat/Makefile.am
2013 Jun 23
3
[PATCH] Add read support for "big data" blocks to hivex
...rning: declared data length " - "is longer than the block it is in " - "(data 0x%zx, data len %zu, block len %zu)\n", - data_offset, len, blen); - len = blen - 4; - - /* Return the smaller length to the caller too. */ - if (len_rtn) - *len_rtn = len; + if (len <= blen - 4 /* subtract 4 for block header */) { + char *data = (char *) h->addr + data_offset + 4; + memcpy (ret, data, len); + return ret; + } else { + if (!IS_VALID_BLOCK (h, data_offset) || !BLOCK_ID_EQ (h, data_offset, "db")) { +...
2015 Mar 03
0
[PATCH v2] fish: add journal-view command
...ted, so you have to print it using "%.*s". - * - * There may be multiple fields with the same name. In this case, the - * function returns the first entry. - */ -static const char * -get_journal_field (const struct guestfs_xattr_list *xattrs, const char *name, - size_t *len_rtn) -{ - uint32_t i; - - for (i = 0; i < xattrs->len; ++i) { - if (STREQ (name, xattrs->val[i].attrname)) { - *len_rtn = xattrs->val[i].attrval_len; - return xattrs->val[i].attrval; - } - } - - return NULL; /* not found */ -} - -static const char *co...
2015 Aug 31
5
[PATCH v5 0/2] RFE: journal reader in guestfish
There seems to be a minor issue when user wants to run it through pager (more) and wants cancel it. User will end up with stuck guestfish until journal-view transfers all journal items. Output is configurable, it's the same format as virt-log has, since both uses same code. Maros Zatko (2): cat: move get_journal_field to fish/journal.c fish: add journal-view command (RHBZ#988100)
2016 May 05
1
[PATCH] python: use constants instead of raw values
...self._python_return_dict = python_return_dict diff --git a/python/guestfs-py-byhand.c b/python/guestfs-py-byhand.c index cf8576f..9e2debf 100644 --- a/python/guestfs-py-byhand.c +++ b/python/guestfs-py-byhand.c @@ -37,6 +37,13 @@ static PyObject **get_all_event_callbacks (guestfs_h *g, size_t *len_rtn); +void +guestfs_int_py_extend_module (PyObject *module) +{ + PyModule_AddIntMacro(module, GUESTFS_CREATE_NO_ENVIRONMENT); + PyModule_AddIntMacro(module, GUESTFS_CREATE_NO_CLOSE_ON_EXIT); +} + PyObject * guestfs_int_py_create (PyObject *self, PyObject *args) { diff --git a/python/guestfs-p...