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 f0c9b98d7c02a01b44e550db62088acb23e5655e (commit)
from 2b25f2693c1cbc2f85be3fd7a152eabff6ae26bb (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/f0c9b98d7c02a01b44e550db62088acb23e5655e
commit f0c9b98d7c02a01b44e550db62088acb23e5655e
Author: Jim Meyering <meyering(a)redhat.com>
Date: Mon Oct 25 20:16:00 2010 +0200
s3_register: correct a diagnostic: s/key/secret/
diff --git a/backend.c b/backend.c
index d3c5aae..173586d 100644
--- a/backend.c
+++ b/backend.c
@@ -416,7 +416,7 @@ s3_register (my_state *ms, const provider_t *prov, const char *next,
if (!api_secret) {
api_secret = (char *)prov->password;
if (!prov->password) {
- error (0, 0, "missing EC2 API key");
+ error (0, 0, "missing EC2 API secret");
goto cleanup;
}
}
-----------------------------------------------------------------------
Summary of changes:
backend.c | 2 +-
1 files changed, 1 insertions(+), 1 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")
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 2b25f2693c1cbc2f85be3fd7a152eabff6ae26bb (commit)
from f74043a7e17d49b1f27e166d88ad8d09e9aafd2a (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/2b25f2693c1cbc2f85be3fd7a152eabff6ae26bb
commit 2b25f2693c1cbc2f85be3fd7a152eabff6ae26bb
Author: Jim Meyering <meyering(a)redhat.com>
Date: Mon Oct 25 19:36:13 2010 +0200
add a reminder not to hard-code /tmp/iwtmp.XXXXXX
We should be able to specify some other directory.
Also add a "const".
diff --git a/backend.c b/backend.c
index 6be25b5..d3c5aae 100644
--- a/backend.c
+++ b/backend.c
@@ -319,13 +319,14 @@ s3_bcreate (const provider_t *prov, const char *bucket)
}
static const char *
-s3_init_tmpfile (char *value)
+s3_init_tmpfile (const char *value)
{
char *path;
int fd;
size_t len;
ssize_t written;
+ /* FIXME: do not hard-code /tmp. */
path = strdup("/tmp/iwtmp.XXXXXX");
if (!path) {
return NULL;
-----------------------------------------------------------------------
Summary of changes:
backend.c | 3 ++-
1 files changed, 2 insertions(+), 1 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")
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 f74043a7e17d49b1f27e166d88ad8d09e9aafd2a (commit)
via b992b5231f12c76a9c33e9cd777a9e1863489d00 (commit)
from 39c17c133e63a5c9b339da577a09e0a77babcf9b (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/f74043a7e17d49b1f27e166d88ad8d09e9aafd2a
commit f74043a7e17d49b1f27e166d88ad8d09e9aafd2a
Author: Pete Zaitcev <zaitcev(a)yahoo.com>
Date: Fri Oct 22 15:32:56 2010 -0600
Bump testing timeouts
I have a slow laptop that needs this. Lots of disk activity when testing,
looks like Mongo does not like ext3 much, at least on Fedora 15.
Note that it's preferable for the framework timeout to be greater than
the autostart's own timeout. This way if autostart times out, it kills
mongo that it started, and usually succeeds. But if we let framework
kill things, mongo sometimes escapes.
Also it's weird, but basic usually succeeds quickly enough, so no bump
there - only bump auto and replication tests.
diff --git a/auto.c b/auto.c
index c385521..b428bce 100644
--- a/auto.c
+++ b/auto.c
@@ -183,7 +183,7 @@ auto_wait_mongod(void)
rc = auto_test_mongod();
if (rc == 0)
break;
- if (time(NULL) >= start_time + 5) {
+ if (time(NULL) >= start_time + 20) {
error(0, 0, "failed to verify mongod using port %s",
auto_arg_port);
return -1;
diff --git a/t/auto b/t/auto
index 86efade..dee4c4e 100644
--- a/t/auto
+++ b/t/auto
@@ -22,11 +22,11 @@ iwhd -v -p $port -a &
iwhd_pid=$!
cleanup_() { kill $iwhd_pid; }
-# Wait for up to 3 seconds for mongod to begin listening.
-wait_for .1 30 'mongo localhost:$m_port < /dev/null' +# Wait for up to 10 seconds for mongod to begin listening.
+wait_for .1 100 'mongo localhost:$m_port < /dev/null' || framework_failure_ mongod failed to start
-# Wait for up to 3 seconds for iwhd to begin listening on $port.
-wait_for .1 30 "curl -s http://localhost:$port" +# Wait for up to 20 seconds for iwhd to begin listening on $port.
+wait_for .1 200 "curl -s http://localhost:$port" || framework_failure_ iwhd failed to start
mongo_pid=$(cat mongo.pid)
diff --git a/t/replication b/t/replication
index fc645b8..74423f2 100644
--- a/t/replication
+++ b/t/replication
@@ -18,8 +18,8 @@ mongod --port $m_port --pidfilepath mongod/pid --dbpath mongod > mongod.log 2>&1
mongo_pid=$!
cleanup_() { kill -9 $mongo_pid; }
-# Wait for up to 3 seconds for mongod to begin listening.
-wait_for .1 30 'mongo localhost:$m_port < /dev/null' +# Wait for up to 12 seconds for mongod to begin listening.
+wait_for .1 120 'mongo localhost:$m_port < /dev/null' || framework_failure_ mongod failed to start
cat > iwhd_u.cfg << EOF
http://repo.or.cz/w/iwhd.git/commit/b992b5231f12c76a9c33e9cd777a9e1863489d00
commit b992b5231f12c76a9c33e9cd777a9e1863489d00
Author: Pete Zaitcev <zaitcev(a)yahoo.com>
Date: Fri Oct 22 15:32:03 2010 -0600
Lock auto.c to IPv4
As it turned out Mongo manages to listen on IPv4 only even if the
system supports IPv6. The autostart tries to connect over IPv6,
depending which address is returned first, and then fails.
The fix is simply to use IPv4 always, at least for loopback.
diff --git a/auto.c b/auto.c
index 6311f41..c385521 100644
--- a/auto.c
+++ b/auto.c
@@ -21,6 +21,7 @@
#include "iwh.h"
#include "state_defs.h"
+static int auto_db_port;
static char auto_arg_port[10];
static char *auto_arg_mongod[] = {
@@ -132,84 +133,34 @@ auto_spawn (const char *prog, char *argv[])
return pid;
}
-/*
- * The server_node and node_resolve are taken verbatim from wait-for-listen.
- * Is this time to factor?
- */
-#define ADDRSIZE 40
-
-struct server_node {
- unsigned alen;
- union {
- struct sockaddr addr;
- unsigned char x[ADDRSIZE];
- } a;
-};
-
-static int
-node_resolve(struct server_node *sn,
- const char *hostname, const char *portstr)
-{
- struct addrinfo hints;
- struct addrinfo *res, *res0;
- int rc;
-
- memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = PF_UNSPEC;
- hints.ai_socktype = SOCK_DGRAM;
-
- rc = getaddrinfo(hostname, portstr, &hints, &res0);
- if (rc) {
- error(0, 0, "getaddrinfo(%s:%s) failed: %s",
- hostname, portstr, gai_strerror(rc));
- return -1;
- }
-
- for (res = res0; res; res = res->ai_next) {
- if (res->ai_family != AF_INET && res->ai_family != AF_INET6)
- continue;
-
- if (res->ai_addrlen > ADDRSIZE) /* should not happen */
- continue;
-
- memcpy(&sn->a.addr, res->ai_addr, res->ai_addrlen);
- sn->alen = res->ai_addrlen;
-
- freeaddrinfo(res0);
- return 0;
- }
-
- freeaddrinfo(res0);
- return -1;
-}
-
static int
auto_test_mongod(void)
{
- struct server_node snode, *sn = &snode;
+ union {
+ struct sockaddr_in a4;
+ struct sockaddr a;
+ } addr;
int sfd;
int rc;
- memset(sn, 0, sizeof(struct server_node));
- if (node_resolve(sn, AUTO_HOST, auto_arg_port) != 0) {
- /*
- * Most likely nothing else would work anyway. So abend.
- */
- error(0, 0, "unable to resolve host %s port %s",
- AUTO_HOST, auto_arg_port);
- return -1;
- }
+ /*
+ * We hardcode IPv4 because Mongo often listens on IPv4 only.
+ */
+ memset(&addr, 0, sizeof(addr));
+ addr.a4.sin_family = AF_INET;
+ addr.a4.sin_port = htons(auto_db_port);
+ addr.a4.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- DPRINTF("trying to connect to mongod (host %s port %s) ...n",
- AUTO_HOST, auto_arg_port);
+ DPRINTF("trying to connect to mongod (host 127.0.0.1 port %u) ...n",
+ auto_db_port);
- sfd = socket(sn->a.addr.sa_family, SOCK_STREAM, 0);
+ sfd = socket(addr.a.sa_family, SOCK_STREAM, 0);
if (sfd < 0) {
error(0, errno, "socket");
return -1;
}
- rc = connect(sfd, &sn->a.addr, sn->alen);
+ rc = connect(sfd, &addr.a, sizeof(addr.a4));
if (rc != 0) {
DPRINTF("connect: %sn", strerror(errno));
close(sfd);
@@ -296,6 +247,7 @@ auto_start (int dbport)
char **earg;
int pid;
+ auto_db_port = dbport;
snprintf(auto_arg_port, sizeof(auto_arg_port), "%u", dbport);
if (auto_prepare_area() < 0)
-----------------------------------------------------------------------
Summary of changes:
auto.c | 84 ++++++++++++--------------------------------------------
t/auto | 8 +++---
t/replication | 4 +-
3 files changed, 24 insertions(+), 72 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")
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 39c17c133e63a5c9b339da577a09e0a77babcf9b (commit)
from 0cbc1d76117be554a5d60f22bc1883fe9ee3de37 (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/39c17c133e63a5c9b339da577a09e0a77babcf9b
commit 39c17c133e63a5c9b339da577a09e0a77babcf9b
Author: Jim Meyering <meyering(a)redhat.com>
Date: Fri Oct 22 16:11:28 2010 +0200
parser: plug more leaks
* qparser.y (parse): Don't leak each expression tree.
(free_value): Handle v == &invalid.
Omit debug printf -- it would cause test failure, now that
we're using free_value more.
(main) [PARSER_UNIT_TEST]: Free "expr".
diff --git a/qparser.y b/qparser.y
index 1c6530a..8e5445e 100644
--- a/qparser.y
+++ b/qparser.y
@@ -426,14 +426,10 @@ print_value (const value_t *v)
void
free_value (value_t *v)
{
- if (!v) {
+ if (v == NULL || v == &invalid) {
return;
}
- if (v->resolved) {
- printf("freeing resolved string "%s" (%p)n",
- v->resolved, v->resolved);
- }
free((void *)v->resolved);
switch (v->type) {
@@ -471,8 +467,10 @@ parse (const char *text)
if (yylex_init (&scanner))
error (0, errno, "failed to initialize query parser");
YY_BUFFER_STATE buf = yy_scan_string (text, scanner);
- value_t *result;
+ value_t *result = NULL;
value_t *r = yyparse (scanner, &result) == 0 ? result : NULL;
+ if (r == NULL)
+ free_value (result);
yy_delete_buffer (buf, scanner);
yylex_destroy (scanner);
return r;
@@ -689,7 +687,7 @@ main (int argc, char **argv)
{
printf ("could not parse '%s'n", argv[i]);
fail = 1;
- continue;
+ goto next;
}
print_value (expr);
@@ -698,9 +696,12 @@ main (int argc, char **argv)
if (str)
{
printf ("s= %sn", str);
- continue;
+ goto next;
}
printf ("d= %dn", eval (expr, &unit_oget, &unit_sget));
+
+ next:
+ free_value (expr);
}
return fail;
-----------------------------------------------------------------------
Summary of changes:
qparser.y | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 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")
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 e2d933c6e5e1d39edc0664d4c21658148e437125 (commit)
from f4d05852a6185b36660f5feee44cdb82ccba7b32 (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/e2d933c6e5e1d39edc0664d4c21658148e437125
commit e2d933c6e5e1d39edc0664d4c21658148e437125
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Oct 21 08:41:59 2010 +0200
plug error path leak
diff --git a/rest.c b/rest.c
index 8f42be3..6bfe1a7 100644
--- a/rest.c
+++ b/rest.c
@@ -910,6 +910,7 @@ proxy_delete (void *cctx, struct MHD_Connection *conn, const char *url,
resp = MHD_create_response_from_data(0,NULL,MHD_NO,MHD_NO);
if (!resp) {
+ free_ms(ms);
return MHD_NO;
}
MHD_queue_response(conn,rc,resp);
-----------------------------------------------------------------------
Summary of changes:
rest.c | 1 +
1 files changed, 1 insertions(+), 0 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")
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 f4d05852a6185b36660f5feee44cdb82ccba7b32 (commit)
via c98f5c1f712ca5b35cbaef83d2ea47015687e68c (commit)
via e6a29d3e5890a27c8f3afae96b8d5a2cf6cbaed6 (commit)
via 064e3f485714996a9a4c85acd32dd514f4481fd6 (commit)
from 2925ba08e51d0fb17df600da56c70e20627ab8e6 (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/f4d05852a6185b36660f5feee44cdb82ccba7b32
commit f4d05852a6185b36660f5feee44cdb82ccba7b32
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Oct 21 09:08:39 2010 +0200
reduce scope of global to be file-only
* qparser.y (hacked_links): Declare to be "static const".
diff --git a/qparser.y b/qparser.y
index a23b5a7..1c6530a 100644
--- a/qparser.y
+++ b/qparser.y
@@ -329,7 +329,7 @@ unit_sget_func (void * notused, const char *text)
static const getter_t unit_sget = { unit_sget_func };
/* Fake links from an object/key tuple to an object/key string. */
-struct { char *obj; char *key; char *value; } hacked_links[] = {
+static const struct { char *obj; char *key; char *value; } hacked_links[] = {
{ "templates/the_tmpl", "owner", "users/the_user" },
{ "users/the_user", "name", "Jeff Darcy" },
{ NULL }
http://repo.or.cz/w/iwhd.git/commit/c98f5c1f712ca5b35cbaef83d2ea47015687e68c
commit c98f5c1f712ca5b35cbaef83d2ea47015687e68c
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 21:36:37 2010 +0200
parser: move x*alloc functions into #if-unit-test block where used
* qparser.y (xalloc_die, xmalloc, xmemdup, xstrdup): Move functions...
[#if PARSER_UNIT_TEST]: ... into this #if-block, since now they're
used only there.
diff --git a/qparser.y b/qparser.y
index cb6d36e..a23b5a7 100644
--- a/qparser.y
+++ b/qparser.y
@@ -28,44 +28,6 @@ static value_t invalid = { T_INVALID, {0}, NULL };
#define YY_DECL int yylex(YYSTYPE *, void *scanner);
YY_DECL
-static void
-xalloc_die (void)
-{
- error (EXIT_FAILURE, 0, "%s", "memory exhausted");
-
- /* The `noreturn' cannot be given to error, since it may return if
- its first argument is 0. To help compilers understand the
- xalloc_die does not return, call abort. Also, the abort is a
- safety feature if exit_failure is 0 (which shouldn't happen). */
- abort ();
-}
-
-/* Allocate N bytes of memory dynamically, with error checking. */
-static void *
-xmalloc (size_t n)
-{
- void *p = malloc (n);
- if (!p && n != 0)
- xalloc_die ();
- return p;
-}
-
-/* Clone an object P of size S, with error checking. There's no need
- for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any
- need for an arithmetic overflow check. */
-static void *
-xmemdup (void const *p, size_t s)
-{
- return memcpy (xmalloc (s), p, s);
-}
-
-/* Clone STRING. */
-static char *
-xstrdup (char const *string)
-{
- return xmemdup (string, strlen (string) + 1);
-}
-
/* TBD: use separate function to parse dates differently */
static value_t *
make_number (const char *text)
@@ -292,6 +254,45 @@ paren_expr:
%%
#if defined PARSER_UNIT_TEST
+
+static void
+xalloc_die (void)
+{
+ error (EXIT_FAILURE, 0, "%s", "memory exhausted");
+
+ /* The `noreturn' cannot be given to error, since it may return if
+ its first argument is 0. To help compilers understand the
+ xalloc_die does not return, call abort. Also, the abort is a
+ safety feature if exit_failure is 0 (which shouldn't happen). */
+ abort ();
+}
+
+/* Allocate N bytes of memory dynamically, with error checking. */
+static void *
+xmalloc (size_t n)
+{
+ void *p = malloc (n);
+ if (!p && n != 0)
+ xalloc_die ();
+ return p;
+}
+
+/* Clone an object P of size S, with error checking. There's no need
+ for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any
+ need for an arithmetic overflow check. */
+static void *
+xmemdup (void const *p, size_t s)
+{
+ return memcpy (xmalloc (s), p, s);
+}
+
+/* Clone STRING. */
+static char *
+xstrdup (char const *string)
+{
+ return xmemdup (string, strlen (string) + 1);
+}
+
static const struct { char *name; char *value; } hacked_obj_fields[] = {
/* Fake object fields for generic unit testing. */
{ "a", "2" }, { "b", "7" }, { "c", "11" },
http://repo.or.cz/w/iwhd.git/commit/e6a29d3e5890a27c8f3afae96b8d5a2cf6cbaed6
commit e6a29d3e5890a27c8f3afae96b8d5a2cf6cbaed6
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 21:34:08 2010 +0200
parser: remove dead code
* qparser.y (xrealloc): Remove if-0'd function.
diff --git a/qparser.y b/qparser.y
index 82b5125..cb6d36e 100644
--- a/qparser.y
+++ b/qparser.y
@@ -50,19 +50,6 @@ xmalloc (size_t n)
return p;
}
-#if 0 // not used
-/* Change the size of an allocated block of memory P to N bytes,
- with error checking. */
-static void *
-xrealloc (void *p, size_t n)
-{
- p = realloc (p, n);
- if (!p && n != 0)
- xalloc_die ();
- return p;
-}
-#endif
-
/* Clone an object P of size S, with error checking. There's no need
for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any
need for an arithmetic overflow check. */
http://repo.or.cz/w/iwhd.git/commit/064e3f485714996a9a4c85acd32dd514f4481fd6
commit 064e3f485714996a9a4c85acd32dd514f4481fd6
Author: Jim Meyering <meyering(a)redhat.com>
Date: Wed Oct 20 21:33:29 2010 +0200
parser: handle OOM gracefully
Before, a failed malloc or strdup would lead to a NULL dereference.
* qparser.y (invalid): New file-scoped global.
(make_number): Never return NULL. Instead, return &invalid.
(make_string): Likewise.
(make_tree): If an input has type T_INVALID, return it right away.
Upon allocation failure, return &invalid.
(make_comp, make_link): Likewise.
(make_link, make_string): Avoid unnecessary strdup, now that
lexed tokens are malloc'd.
Also, add some per-function comments.
diff --git a/qparser.y b/qparser.y
index 99267c4..82b5125 100644
--- a/qparser.y
+++ b/qparser.y
@@ -21,6 +21,10 @@
#include "iwh.h"
+/* Return a pointer to this when allocation fails in a value_t-returning
+ function. */
+static value_t invalid = { T_INVALID, {0}, NULL };
+
#define YY_DECL int yylex(YYSTYPE *, void *scanner);
YY_DECL
@@ -80,71 +84,79 @@ static value_t *
make_number (const char *text)
{
value_t *tmp = malloc(sizeof(*tmp));
+ if (!tmp)
+ return &invalid;
- if (tmp) {
- tmp->type = T_NUMBER;
- tmp->as_num = strtoll(text,NULL,10);
- tmp->resolved = NULL;
- }
+ tmp->type = T_NUMBER;
+ tmp->as_num = strtoll(text,NULL,10);
+ tmp->resolved = NULL;
free ((void *) text);
return tmp;
}
+/* Return a malloc'd value_t buffer, with its type to T and using TEXT
+ (already malloc'd) as its string. */
static value_t *
make_string (const char *text, type_t t)
{
value_t *tmp = malloc(sizeof(*tmp));
+ if (!tmp)
+ return &invalid;
- if (tmp) {
- tmp->type = t;
- tmp->as_str = xstrdup(text);
- tmp->resolved = NULL;
- }
- free ((void *) text);
+ tmp->type = t;
+ tmp->as_str = (char *) text;
+ tmp->resolved = NULL;
return tmp;
}
+/* Return a malloc'd tree_t, with type T and branches LEFT and RIGHT.
+ LEFT must be non-NULL. RIGHT may be NULL (solely for use in handling
+ a negated expression). */
static value_t *
make_tree (type_t t, const value_t *left, const value_t *right)
{
+ if (left->type == T_INVALID)
+ return (value_t *) left;
+ if (t != T_LINK && right && right->type == T_INVALID)
+ return (value_t *) right;
value_t *tmp = malloc(sizeof(*tmp));
- if (tmp) {
- tmp->type = t;
- tmp->as_tree.left = (value_t *) left;
- tmp->as_tree.right = (value_t *) right;
- tmp->resolved = NULL;
- }
+ if (!tmp)
+ return &invalid;
+
+ tmp->type = t;
+ tmp->as_tree.left = (value_t *) left;
+ tmp->as_tree.right = (value_t *) right;
+ tmp->resolved = NULL;
return tmp;
}
+/* Return a malloc'd comp_t, with type T and branches LEFT and RIGHT.
+ LEFT and RIGHT must both be non-NULL. */
static value_t *
make_comp (comp_t c, const value_t *left, const value_t *right)
{
+ if (left->type == T_INVALID)
+ return (value_t *) left;
+ if (right->type == T_INVALID)
+ return (value_t *) right;
value_t *tmp = make_tree(T_COMP,left,right);
- if (tmp) {
- tmp->as_tree.op = c;
- }
+ if (!tmp)
+ return &invalid;
+
+ tmp->as_tree.op = c;
return tmp;
}
static value_t *
-make_link (value_t *left, const char *right)
+make_link (const value_t *left, const char *right)
{
- char *copy;
-
- copy = xstrdup(right);
- free ((void *) right);
- if (!copy) {
- return NULL;
- }
-
- return make_tree(T_LINK,left,(value_t *)copy);
+ return make_tree(T_LINK,left,(value_t *)right);
}
static void
-----------------------------------------------------------------------
Summary of changes:
qparser.y | 164 ++++++++++++++++++++++++++++++------------------------------
1 files changed, 82 insertions(+), 82 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")
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 2925ba08e51d0fb17df600da56c70e20627ab8e6 (commit)
via 70765c12c21e6f433d00bae5ea64f377f6f28f03 (commit)
from 26af6493b707f493676f3151557a04c25dd69a8e (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/2925ba08e51d0fb17df600da56c70e20627ab8e6
commit 2925ba08e51d0fb17df600da56c70e20627ab8e6
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Oct 21 10:35:51 2010 -0400
Add unlink/O_EXCL in case new file is shorter than what's there.
diff --git a/backend.c b/backend.c
index 07643d1..6be25b5 100644
--- a/backend.c
+++ b/backend.c
@@ -1249,7 +1249,10 @@ fs_put_child (void * ctx)
error(0,0,"path too long in %s",__func__);
return NULL;
}
- fd = open(fixed,O_WRONLY|O_CREAT,0666);
+ if (unlink(fixed) < 0) {
+ error(0,errno,"unlink failed for %s (non-fatal)",fixed);
+ }
+ fd = open(fixed,O_WRONLY|O_CREAT|O_EXCL,0666);
if (fd < 0) {
pipe_cons_siginit(ps, errno);
free(pp);
http://repo.or.cz/w/iwhd.git/commit/70765c12c21e6f433d00bae5ea64f377f6f28f03
commit 70765c12c21e6f433d00bae5ea64f377f6f28f03
Author: Jeff Darcy <jdarcy(a)redhat.com>
Date: Thu Oct 21 10:33:02 2010 -0400
Add X-redhat-role header when replicating to ourselves.
diff --git a/backend.c b/backend.c
index 61fa515..07643d1 100644
--- a/backend.c
+++ b/backend.c
@@ -628,15 +628,16 @@ curl_get_child (void * ctx)
static void *
curl_put_child (void * ctx)
{
- pipe_private *pp = ctx;
- pipe_shared *ps = pp->shared;
- my_state *ms = ps->owner;
- provider_t *prov = pp->prov;
- curl_off_t llen;
- char fixed[ADDR_SIZE];
- CURL *curl;
- const char *clen;
- int chars;
+ pipe_private *pp = ctx;
+ pipe_shared *ps = pp->shared;
+ my_state *ms = ps->owner;
+ provider_t *prov = pp->prov;
+ curl_off_t llen;
+ char fixed[ADDR_SIZE];
+ CURL *curl;
+ const char *clen;
+ struct curl_slist *slist = NULL;
+ int chars;
llen = (curl_off_t)MHD_SIZE_UNKNOWN;
if (ms->be_flags & BACKEND_GET_SIZE) {
@@ -650,6 +651,13 @@ curl_put_child (void * ctx)
}
}
+ /*
+ * This is how the iwhd at the other end knows this is a replication
+ * request and not just a PUT from some random user.
+ * TBD: add some auth* for this.
+ */
+ slist = curl_slist_append(slist,"X-redhat-role: master");
+
curl = curl_easy_init();
if (!curl) {
pipe_cons_siginit(ps, -1);
@@ -667,9 +675,11 @@ curl_put_child (void * ctx)
curl_easy_setopt(curl,CURLOPT_INFILESIZE_LARGE,llen);
curl_easy_setopt(curl,CURLOPT_READFUNCTION,http_put_cons);
curl_easy_setopt(curl,CURLOPT_READDATA,pp);
+ curl_easy_setopt(curl,CURLOPT_HTTPHEADER,slist);
pipe_cons_siginit(ps, 0);
curl_easy_perform(curl);
curl_easy_cleanup(curl);
+ curl_slist_free_all(slist);
DPRINTF("%s returningn",__func__);
free(pp);
-----------------------------------------------------------------------
Summary of changes:
backend.c | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 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")