This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via 4cb41b49a2b69509658d4fb90c21efde29476d9d (commit)
via 25a832f79a7685cecad169206df7a235547b81f8 (commit)
from 9e39dc2a1855c7c313e39f643c1681f1bd32f141 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/4cb41b49a2b69509658d4fb90c21efde29476d9d
commit 4cb41b49a2b69509658d4fb90c21efde29476d9d
Author: Jim Meyering <meyering(a)redhat.com>
Date: Mon Feb 14 14:14:05 2011 +0100
avoid file descriptor leak in replication
The "pipes[2]" member was set by calling pipe, but those
two descriptors were never closed or even used.
* replica.c (struct _repl_item) [pipes[2]]: Remove member.
(repl_worker): Don't use ->pipes.
diff --git a/replica.c b/replica.c
index 5540efa..ee1034a 100644
--- a/replica.c
+++ b/replica.c
@@ -49,7 +49,6 @@ typedef struct _repl_item {
char *path;
provider_t *server;
size_t size;
- int pipes[2];
my_state *ms;
} repl_item;
@@ -181,17 +180,12 @@ repl_worker (void *notused ATTRIBUTE_UNUSED)
pipe_init_shared(&ms->pipe,ms,1);
switch (item->type) {
case REPL_PUT:
- if (pipe(item->pipes) >= 0) {
- xpthread_create(&prod,proxy_repl_prod,item,
- "failed to start producer thread");
- xpthread_create(&cons,proxy_repl_cons,item,
- "failed to start consumer thread");
- pthread_join(prod,NULL);
- pthread_join(cons,NULL);
- }
- else {
- error(0, errno, "pipe failed");
- }
+ xpthread_create(&prod,proxy_repl_prod,item,
+ "failed to start producer thread");
+ xpthread_create(&cons,proxy_repl_cons,item,
+ "failed to start consumer thread");
+ pthread_join(prod,NULL);
+ pthread_join(cons,NULL);
break;
case REPL_ODELETE:
repl_worker_del(item);
@@ -201,7 +195,7 @@ repl_worker (void *notused ATTRIBUTE_UNUSED)
break;
default:
error(0,0,"bad repl type %d (url=%s) skipped",
- item->type, item->path);
+ item->type, item->path);
}
/* No atomic dec without test? Lame. */
(void)g_atomic_int_dec_and_test(&rep_count);
http://repo.or.cz/w/iwhd.git/commit/25a832f79a7685cecad169206df7a235547b81f8
commit 25a832f79a7685cecad169206df7a235547b81f8
Author: Jim Meyering <meyering(a)redhat.com>
Date: Mon Feb 14 13:44:23 2011 +0100
tweak diagnostics
diff --git a/backend.c b/backend.c
index bd78ad5..003406f 100644
--- a/backend.c
+++ b/backend.c
@@ -512,7 +512,7 @@ s3_register (my_state *ms, const provider_t *prov, const char *next,
(void)dup2(organ[1],STDOUT_FILENO);
(void)dup2(organ[1],STDERR_FILENO);
execvp(cmd, (char* const*)argv);
- error (EXIT_FAILURE, errno, "failed run command %s", cmd);
+ error (EXIT_FAILURE, errno, "failed to run command %s", cmd);
}
DPRINTF("waiting for child...n");
diff --git a/replica.c b/replica.c
index a813d82..5540efa 100644
--- a/replica.c
+++ b/replica.c
@@ -190,7 +190,7 @@ repl_worker (void *notused ATTRIBUTE_UNUSED)
pthread_join(cons,NULL);
}
else {
- error(0,errno,"pipe");
+ error(0, errno, "pipe failed");
}
break;
case REPL_ODELETE:
-----------------------------------------------------------------------
Summary of changes:
backend.c | 2 +-
replica.c | 20 +++++++-------------
2 files changed, 8 insertions(+), 14 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")