tools/xenstore: Document failure for xs_{read, directory, read_watch}
PATCH 1/1 tools/xenstore: Document failure for xs_{read, directory, read_watch}
Those functions can return NULL on failure, document it in the public header.
--- tools/xenstore/include/xenstore.h | 7 +++++-- tools/xenstore/xs.c | 1 + 2 files changed, 6 insertions(+), 2 deletions(-)
tools/xenstore/include/xenstore.h +5 -2
@@ -103,6 +103,7 @@ void xs_daemon_destroy_postfork(struct xs_handle *);/* Get contents of a directory. * Returns a malloced array: call free() on it after use. * Num indicates size. +* Returns NULL on failure. */ char **xs_directory (struct xs_handle *h,xs_transaction_t t,const char *path,unsigned int *num);
@@ -110,6 +111,7 @@ char **xs_directory(struct xs_handle *h, xs_transaction_t t,/* Get the value of a single file, nul terminated. * Returns a malloced value: call free() on it after use. * len indicates length in bytes, not including terminator. +* Returns NULL on failure. */ void *xs_read (struct xs_handle *h,xs_transaction_t t,const char *path,unsigned int *len);
@@ -196,8 +198,9 @@ int xs_fileno(struct xs_handle *h);char **xs_check_watch (struct xs_handle *h);/* Find out what node change was on (will block if nothing pending). -* Returns array containing the path and token. Use XS_WATCH_* to access these -* elements. Call free() after use. +* Returns array containing the path and token, or NULL. +* Use XS_WATCH_* to access these elements. +* Call free() after use. */ char **xs_read_watch (struct xs_handle *h,unsigned int *num);
tools/xenstore/xs.c +1 -0
@@ -680,6 +680,7 @@ char **xs_directory(struct xs_handle *h, xs_transaction_t t,/* Get the value of a single file, nul terminated. * Returns a malloced value: call free() on it after use. * len indicates length in bytes, not including the nul. +* Returns NULL on failure. */ void *xs_read (struct xs_handle *h,xs_transaction_t t,const char *path,unsigned int *len)
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines
-----Original Message-----
From: Anthony PERARD [mailto:[email protected]]
Sent: 05 December 2018 16:26
To: [email protected]
Cc: Paul Durrant <[email protected]>; Anthony Perard <[email protected]>; Ian Jackson <[email protected]>; Wei Liu <[email protected]>
Subject: [PATCH]tools/xenstore: Document failure for xs_{read,directory,read_watch}
Quoted 4 lines
Those functions can return NULL on failure, document it in the public header.
Signed-off-by Anthony PERARD <[email protected]>
Quoted 52 lines
--- tools/xenstore/include/xenstore.h | 7 +++++-- tools/xenstore/xs.c | 1 + 2 files changed, 6 insertions(+), 2 deletions(-)tools/xenstore/include/xenstore.h +2
-0@@ -103,6 +103,7 @@ void xs_daemon_destroy_postfork(struct xs_handle *);/* Get contents of a directory. * Returns a malloced array: call free() on it after use. * Num indicates size. +* Returns NULL on failure. */ char **xs_directory (struct xs_handle *h,xs_transaction_t t,const char *path,unsigned int *num);@@ -110,6 +111,7 @@ char **xs_directory(struct xs_handle *h,xs_transaction_t t,/* Get the value of a single file, nul terminated. * Returns a malloced value: call free() on it after use. * len indicates length in bytes, not including terminator. +* Returns NULL on failure. */ void *xs_read(struct xs_handle *h, xs_transaction_t t,tools/xenstore/include/xenstore.h +0
-1const char *path, unsigned int *len);@@ -196,8 +198,9 @@ int xs_fileno(struct xs_handle *h);char **xs_check_watch (struct xs_handle *h);/* Find out what node change was on (will block if nothing pending). -* Returns array containing the path and token. Use XS_WATCH_* to access these
- * elements. Callfree()after use.
+ * Returns array containing the path and token, or NULL.
+ * Use XS_WATCH_* to access these elements.
+ * Callfree()after use.
*/
char **xs_read_watch(structxs_handle*h, unsigned int *num);tools/xenstore/xs.c +1
-0@@ -680,6 +680,7 @@ char **xs_directory(struct xs_handle *h,xs_transaction_t t,/* Get the value of a single file, nul terminated. * Returns a malloced value: call free() on it after use. * len indicates length in bytes, not including the nul. +* Returns NULL on failure. */ void *xs_read(struct xs_handle *h, xs_transaction_t t,
Quoted 3 lines
const char *path, unsigned int *len)
--
Anthony PERARD
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 4 lines · Anthony PERARD
Those functions can return NULL on failure, document it in the public header.
Signed-off-by Anthony PERARD <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel