[SCM] CTDB repository - branch master updated - ctdb-2.1-37-g307416a

Amitay Isaacs amitay at samba.org
Mon Mar 25 00:38:56 MDT 2013


The branch, master has been updated
       via  307416afda707b687f5e89e8438e45c154a4c806 (commit)
       via  08c53ee609b80f87450a7a1d7dd24fbcdf5ab7bc (commit)
      from  87c89b7c2a14e2ee79a3efc7e8125842bc04bf23 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 307416afda707b687f5e89e8438e45c154a4c806
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Mar 13 22:57:44 2013 +1100

    util: Add hex_decode_talloc() to decode hex string into a binary blob
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

commit 08c53ee609b80f87450a7a1d7dd24fbcdf5ab7bc
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Mar 13 11:46:18 2013 +1100

    logging: Do not ignore stdout/stderr from the exec'd children
    
    To log debugging information from child processes that are started
    with vfork and exec, do not set close_on_exec on STDOUT and STDERR for
    that process.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 include/includes.h    |    1 +
 lib/util/util_file.c  |   16 ++++++++++++++++
 server/ctdb_logging.c |    5 -----
 3 files changed, 17 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/includes.h b/include/includes.h
index e0ce06b..3747198 100644
--- a/include/includes.h
+++ b/include/includes.h
@@ -58,6 +58,7 @@ double timeval_elapsed(struct timeval *tv);
 double timeval_delta(struct timeval *tv2, struct timeval *tv);
 char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx);
 char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len);
+uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx, const char *hex_in, size_t *len);
 _PUBLIC_ const char **str_list_add(const char **list, const char *s);
 _PUBLIC_ int set_blocking(int fd, bool set);
 
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 21d64b2..3a90201 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -114,3 +114,19 @@ char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_
 
 	return hex_buffer;
 }
+
+uint8_t *hex_decode_talloc(TALLOC_CTX *mem_ctx, const char *hex_in, size_t *len)
+{
+	int i, num;
+	uint8_t *buffer;
+
+	*len = strlen(hex_in) / 2;
+	buffer = talloc_array(mem_ctx, unsigned char, *len);
+
+	for (i=0; i<*len; i++) {
+		sscanf(&hex_in[i*2], "%02X", &num);
+		buffer[i] = (uint8_t)num;
+	}
+
+	return buffer;
+}
diff --git a/server/ctdb_logging.c b/server/ctdb_logging.c
index 7cf8b9f..dfb5063 100644
--- a/server/ctdb_logging.c
+++ b/server/ctdb_logging.c
@@ -538,11 +538,6 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
 	close(old_stdout);
 	close(old_stderr);
 
-	/* Is this correct for STDOUT and STDERR ? */
-	set_close_on_exec(STDOUT_FILENO);
-	set_close_on_exec(STDERR_FILENO);
-	set_close_on_exec(p[0]);
-
 	fde = event_add_fd(ctdb->ev, ctdb->log, p[0],
 			   EVENT_FD_READ, ctdb_log_handler, ctdb->log);
 	tevent_fd_set_auto_close(fde);


-- 
CTDB repository


More information about the samba-cvs mailing list