aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2008-07-14 23:35:28 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2008-07-14 23:35:28 +0000
commit20e08ebe561d4ac2d1e9e26fcf74162b93f8555e (patch)
treecbdf8096c494647b69aa207e35a8809743625ded
parent4a3ee4cee740ac1cda420bef0bb33662688e2f74 (diff)
downloadwydawca-20e08ebe561d4ac2d1e9e26fcf74162b93f8555e.tar.gz
wydawca-20e08ebe561d4ac2d1e9e26fcf74162b93f8555e.tar.bz2
* src/wydawca.h (register_message_template): New prototype.
* src/verify.c (fill_project_name): Fix return value. * src/config.c (_cfg_raw_read): Remove unused variables. * src/directive.c (directive_version_in_range_p): Version is unsigned. * src/mail.c (do_notify): Remove unused variable. * src/diskio.c (copy_file): Fall back to user-space copying if sendile fails with EINVAL. Always remove destination file on failure. * src/triplet.c (expand_triplet_upload): Initialize exp->value. git-svn-id: file:///svnroot/wydawca/trunk@323 6bb4bd81-ecc2-4fd4-a2d4-9571d19c0d33
-rw-r--r--ChangeLog11
-rw-r--r--src/config.c4
-rw-r--r--src/directive.c4
-rw-r--r--src/diskio.c135
-rw-r--r--src/mail.c4
-rw-r--r--src/triplet.c3
-rw-r--r--src/verify.c4
-rw-r--r--src/wydawca.h5
8 files changed, 89 insertions, 81 deletions
diff --git a/ChangeLog b/ChangeLog
index 1741f15..06c918c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-07-15 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * src/wydawca.h (register_message_template): New prototype.
+ * src/verify.c (fill_project_name): Fix return value.
+ * src/config.c (_cfg_raw_read): Remove unused variables.
+ * src/directive.c (directive_version_in_range_p): Version is unsigned.
+ * src/mail.c (do_notify): Remove unused variable.
+ * src/diskio.c (copy_file): Fall back to user-space copying if sendile
+ fails with EINVAL. Always remove destination file on failure.
+ * src/triplet.c (expand_triplet_upload): Initialize exp->value.
+
2007-11-19 Sergey Poznyakoff <gray@gnu.org.ua>
* configure.ac: Use AM_GNU_MAILUTILS
diff --git a/src/config.c b/src/config.c
index c21c14b..4203bbb 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1,5 +1,5 @@
/* wydawca - automatic release submission daemon
- Copyright (C) 2007 Sergey Poznyakoff
+ Copyright (C) 2007, 2008 Sergey Poznyakoff
Wydawca is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -916,8 +916,6 @@ _cfg_recursive_raw_read (gsc_config_file_t *file, struct obstack *stk,
static int
_cfg_raw_read (gsc_config_file_t *file, char *val, struct obstack *stk)
{
- size_t size = 0;
- char *buf = NULL;
char *word = val ? get_word (&val) : "";
size_t wlen;
size_t start_line = file->line;
diff --git a/src/directive.c b/src/directive.c
index 924582c..eeb82c1 100644
--- a/src/directive.c
+++ b/src/directive.c
@@ -1,5 +1,5 @@
/* wydawca - automatic release submission daemon
- Copyright (C) 2007 Sergey Poznyakoff
+ Copyright (C) 2007, 2008 Sergey Poznyakoff
Wydawca is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -169,7 +169,7 @@ directive_version_in_range_p (struct file_triplet *trp,
unsigned from, unsigned to)
{
const char *val;
- int version;
+ unsigned version;
if (directive_get_value (trp, "version", &val))
{
diff --git a/src/diskio.c b/src/diskio.c
index bc12971..832b329 100644
--- a/src/diskio.c
+++ b/src/diskio.c
@@ -1,5 +1,5 @@
/* wydawca - automatic release submission daemon
- Copyright (C) 2007 Sergey Poznyakoff
+ Copyright (C) 2007, 2008 Sergey Poznyakoff
Wydawca is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -173,77 +173,76 @@ copy_file (const char *file, const char *dst_file, uid_t uid, gid_t gid)
}
#ifdef USE_SENDFILE
- {
- off_t offset = 0;
- ssize_t count;
+ {
+ off_t offset = 0;
+ ssize_t count;
- count = sendfile (out_fd, in_fd, &offset, st.st_size);
- if (count == -1)
- {
- rc = 1;
- logmsg (LOG_ERR, "copying %s to %s failed: %s",
- file, dst_file, strerror (errno));
- }
- else if (count < st.st_size)
- {
- rc = 1;
- logmsg (LOG_ERR, "copying %s to %s failed: short write",
- file, dst_file);
- unlink (dst_file);
- }
- else
- rc = 0;
- }
-#else
- {
- char *buf = NULL;
- size_t bufsize;
- size_t fsize = st.st_size;
-
- for (bufsize = fsize; bufsize > 0 && (buf = malloc (bufsize)) == NULL;
- bufsize /= 2)
- ;
- if (bufsize == 0)
- xalloc_die ();
-
- rc = 0;
- while (fsize > 0)
- {
- size_t rest;
- size_t rdbytes;
-
- rest = fsize > bufsize ? bufsize : fsize;
- rdbytes = read (in_fd, buf, rest);
- if (rdbytes == -1)
- {
- logmsg (LOG_ERR, "unexpected error reading %s: %s",
- file, strerror (errno));
- unlink (dst_file);
- rc = 1;
- break;
- }
- rest = write (out_fd, buf, rdbytes);
- if (rest == -1)
- {
- logmsg (LOG_ERR, "unexpected error writing to %s: %s",
- dst_file, strerror (errno));
- unlink (dst_file);
- rc = 1;
- break;
- }
- else if (rest != rdbytes)
- {
- logmsg (LOG_ERR, "short write on %s", dst_file);
- unlink (dst_file);
- rc = 1;
- }
- fsize -= rdbytes;
- }
- free (buf);
- }
+ count = sendfile (out_fd, in_fd, &offset, st.st_size);
+ if (count == -1)
+ {
+ rc = 1;
+ logmsg (LOG_ERR, "copying %s to %s failed: %s",
+ file, dst_file, strerror (errno));
+ }
+ else if (count < st.st_size)
+ {
+ rc = 1;
+ logmsg (LOG_ERR, "copying %s to %s failed: short write",
+ file, dst_file);
+ }
+ else
+ rc = 0;
+ }
+ if (rc && errno == EINVAL)
#endif
+ {
+ char *buf = NULL;
+ size_t bufsize;
+ size_t fsize = st.st_size;
+
+ for (bufsize = fsize; bufsize > 0 && (buf = malloc (bufsize)) == NULL;
+ bufsize /= 2)
+ ;
+ if (bufsize == 0)
+ xalloc_die ();
+
+ rc = 0;
+ while (fsize > 0)
+ {
+ size_t rest;
+ size_t rdbytes;
+
+ rest = fsize > bufsize ? bufsize : fsize;
+ rdbytes = read (in_fd, buf, rest);
+ if (rdbytes == -1)
+ {
+ logmsg (LOG_ERR, "unexpected error reading %s: %s",
+ file, strerror (errno));
+ rc = 1;
+ break;
+ }
+ rest = write (out_fd, buf, rdbytes);
+ if (rest == -1)
+ {
+ logmsg (LOG_ERR, "unexpected error writing to %s: %s",
+ dst_file, strerror (errno));
+ rc = 1;
+ break;
+ }
+ else if (rest != rdbytes)
+ {
+ logmsg (LOG_ERR, "short write on %s", dst_file);
+ rc = 1;
+ }
+ fsize -= rdbytes;
+ }
+ free (buf);
+ }
+
close (in_fd);
close (out_fd);
+ if (rc)
+ unlink (dst_file);
return rc;
}
diff --git a/src/mail.c b/src/mail.c
index d777a2e..f519413 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -1,5 +1,5 @@
/* wydawca - automatic release submission daemon
- Copyright (C) 2007 Sergey Poznyakoff
+ Copyright (C) 2007, 2008 Sergey Poznyakoff
Wydawca is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -268,10 +268,8 @@ void
do_notify (struct file_triplet *trp, enum notification_event ev,
struct notification *ntf)
{
- int rc;
mu_address_t rcpt = NULL;
char *errp;
-
switch (ntf->tgt)
{
case notify_admin:
diff --git a/src/triplet.c b/src/triplet.c
index e7bab3e..de8c8d6 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -1,5 +1,5 @@
/* wydawca - automatic release submission daemon
- Copyright (C) 2007 Sergey Poznyakoff
+ Copyright (C) 2007, 2008 Sergey Poznyakoff
Wydawca is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -423,6 +423,7 @@ expand_triplet_upload (struct kw_expansion *exp, void *data)
size += strlen (buf[file_signature]) + 1;
exp->value = xmalloc (size + 1);
+ exp->value[0] = 0;
if (buf[file_dist])
{
strcat(exp->value, buf[file_dist]);
diff --git a/src/verify.c b/src/verify.c
index 2290fce..a97fbea 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -1,5 +1,5 @@
/* wydawca - automatic release submission daemon
- Copyright (C) 2007 Sergey Poznyakoff
+ Copyright (C) 2007, 2008 Sergey Poznyakoff
Wydawca is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -250,7 +250,7 @@ fill_project_name (struct file_triplet *trp)
char *p;
if (trp->project)
- return;
+ return 1;
if (directive_get_value (trp, "directory", &directory))
{
logmsg (LOG_ERR, "%s: missing `directory' directive",
diff --git a/src/wydawca.h b/src/wydawca.h
index 39d1073..d623e53 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -1,5 +1,5 @@
/* wydawca - automatic release submission daemon
- Copyright (C) 2007 Sergey Poznyakoff
+ Copyright (C) 2007, 2008 Sergey Poznyakoff
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -209,7 +209,8 @@ struct message_template *find_message_template (char *name);
void register_notification (enum notification_event ev,
enum notification_target tgt,
struct message_template *msg);
-
+void register_message_template (char *name, char *text);
+
void notify (struct file_triplet *, enum notification_event);
const char *notification_event_str (enum notification_event evt);

Return to:

Send suggestions and report system problems to the System administrator.