chiark
/
gitweb
/
~ian
/
chiark-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changelog: Document -t option
[chiark-utils.git]
/
cprogs
/
cgi-fcgi-interp.c
diff --git
a/cprogs/cgi-fcgi-interp.c
b/cprogs/cgi-fcgi-interp.c
index 2c157d218033a372c6e53c144cb091e29952ed18..63db94b35fed7a1d3afb3f11c96858a31d3c70d7 100644
(file)
--- a/
cprogs/cgi-fcgi-interp.c
+++ b/
cprogs/cgi-fcgi-interp.c
@@
-4,7
+4,7
@@
* #!/usr/bin/cgi-fcgi-interp [<options>],<interpreter>
*/
/*
* #!/usr/bin/cgi-fcgi-interp [<options>],<interpreter>
*/
/*
- * cgi-fcgi-interp.[ch] - C
helpers common to the whole of chiark-utils
+ * cgi-fcgi-interp.[ch] - C
onvenience wrapper for cgi-fcgi
*
* Copyright 2016 Ian Jackson
* Copyright 1982,1986,1993 The Regents of the University of California
*
* Copyright 2016 Ian Jackson
* Copyright 1982,1986,1993 The Regents of the University of California
@@
-441,12
+441,12
@@
static bool stab_isnewer(const struct stat *a, const struct stat *b) {
fprintf(stderr,"stab_isnewer mtime %lu %lu\n",
(unsigned long)a->st_mtime,
(unsigned long)b->st_mtime);
fprintf(stderr,"stab_isnewer mtime %lu %lu\n",
(unsigned long)a->st_mtime,
(unsigned long)b->st_mtime);
- return a->st_mtime >
&
b->st_mtime;
+ return a->st_mtime > b->st_mtime;
}
static void stab_mtimenow(struct stat *out) {
out->st_mtime = time(NULL);
}
static void stab_mtimenow(struct stat *out) {
out->st_mtime = time(NULL);
- if (
baseline_time.
st_mtime == (time_t)-1) diee("(stage2) time()");
+ if (
out->
st_mtime == (time_t)-1) diee("(stage2) time()");
if (debugmode)
fprintf(stderr,"stab_mtimenow mtime %lu\n",
(unsigned long)out->st_mtime);
if (debugmode)
fprintf(stderr,"stab_mtimenow mtime %lu\n",
(unsigned long)out->st_mtime);
@@
-604,7
+604,6
@@
int main(int argc, const char *const *argv) {
script = *argv++;
if (!script) badusage("need script argument");
script = *argv++;
if (!script) badusage("need script argument");
- if (*argv) badusage("too many arguments");
if (!stage2) {
if (!stage2) {
@@
-789,12
+788,19
@@
static void errpipe_readable(void) {
static char buf[1024];
static int pending;
static char buf[1024];
static int pending;
+ /* %: does not contain newlines
+ * _: empty (garbage)
+ */
+
+ /* %%%%%%%%%%%__________________ */
+ /* ^ pending */
+
for (;;) {
int avail = sizeof(buf) - pending;
ssize_t got = read(errpipe, buf+pending, avail);
if (got==-1) {
if (errno==EINTR) continue;
for (;;) {
int avail = sizeof(buf) - pending;
ssize_t got = read(errpipe, buf+pending, avail);
if (got==-1) {
if (errno==EINTR) continue;
- else if (errno==EWOULDBLOCK || errno==EAGAIN)
/*ok*/
;
+ else if (errno==EWOULDBLOCK || errno==EAGAIN)
return
;
else diee("(stage2) errpipe read");
got = 0;
} else if (got==0) {
else diee("(stage2) errpipe read");
got = 0;
} else if (got==0) {
@@
-819,6
+825,7
@@
static void errpipe_readable(void) {
}
syslog(LOG_ERR,"stderr: %.*s", printupto-eaten, buf+eaten);
eaten += eat;
}
syslog(LOG_ERR,"stderr: %.*s", printupto-eaten, buf+eaten);
eaten += eat;
+ scanned = eaten;
}
pending -= eaten;
memmove(buf, buf+eaten, pending);
}
pending -= eaten;
memmove(buf, buf+eaten, pending);