[repo.or.cz] iwhd.git branch master updated: v0.0-107-gbedf9e1
by Jim Meyering
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 bedf9e129597380eb865de17abe3245d90076158 (commit)
from d40ae99163994b6995a16505ae590399fa416b1e (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/bedf9e129597380eb865de17abe3245d90076158
commit bedf9e129597380eb865de17abe3245d90076158
Author: Jim Meyering <meyering(a)redhat.com>
Date: Sat Sep 25 09:27:44 2010 +0200
avoid printf format abuse; use -Wformat-security; report errno more
A use like "error(0,errno,cfg_file)" would malfunction for a file
name containing a printf %-directive. Using -Wformat-security
will help prevent this.
Upon OOM, always use errno in the diagnostic.
diff --git a/Makefile.am b/Makefile.am
index ed09056..6a22e11 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-AM_CFLAGS = -W -Wall -Wextra -Wno-unused +AM_CFLAGS = -W -Wall -Wextra -Wno-unused -Wformat-security -Wp,-D_FORTIFY_SOURCE=2 -O2 -fdiagnostics-show-option
AM_CPPFLAGS = -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
diff --git a/proxy.c b/proxy.c
index 493b63d..ba34b8e 100644
--- a/proxy.c
+++ b/proxy.c
@@ -210,7 +210,7 @@ parse_config (void)
unsigned int i;
if (access(cfg_file,R_OK) < 0) {
- error(0,errno,cfg_file);
+ error(0,errno,"failed to open %s for reading", cfg_file);
return NULL;
}
@@ -282,7 +282,7 @@ proxy_repl_prod_fs (void *ctx)
ibytes = read(ifd,buf,sizeof(buf));
if (ibytes <= 0) {
if (ibytes < 0) {
- error(0,errno,"read");
+ error(0,errno,"%s: read failed", item->path);
}
else {
DPRINTF("EOF on ifdn");
@@ -847,12 +847,17 @@ replicate (const char *url, size_t size, const char *policy)
DPRINTF("REPLICATING %s to %un",url,i);
item = malloc(sizeof(*item));
if (!item) {
- error(0,0,"could not create repl_item for %sn",
- url);
+ error(0,errno,"could not create repl_item for %sn",
+ url);
break;
}
item->type = REPL_PUT;
item->path = strdup(url);
+ if (!item->path) {
+ error(0,errno,"could not create repl_item for %sn",
+ url);
+ break;
+ }
item->server = i;
item->size = size;
pthread_mutex_lock(&queue_lock);
@@ -885,8 +890,8 @@ replicate_namespace_action (const char *name, repl_t action)
DPRINTF("replicating delete(%s) on %un",name,i);
item = malloc(sizeof(*item));
if (!item) {
- error(0,0,"could not create repl_item for %sn",
- name);
+ error(0,errno,"could not create repl_item for %sn",
+ name);
return;
}
item->type = action;
-----------------------------------------------------------------------
Summary of changes:
Makefile.am | 2 +-
proxy.c | 17 +++++++++++------
2 files changed, 12 insertions(+), 7 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")
13 years, 7 months