chiark
/
gitweb
/
~ian
/
chiark-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
96bcf59
)
cgi-fcgi-perl: wip, check_garbage
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 22 Mar 2016 13:38:08 +0000
(13:38 +0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 22 Mar 2016 13:38:08 +0000
(13:38 +0000)
cprogs/cgi-fcgi-perl.c
patch
|
blob
|
history
diff --git
a/cprogs/cgi-fcgi-perl.c
b/cprogs/cgi-fcgi-perl.c
index 58a858ae41fede971bc4372001c2427a2ff222e9..83bd962db51d74da7e1412da037283f0b6421ff8 100644
(file)
--- a/
cprogs/cgi-fcgi-perl.c
+++ b/
cprogs/cgi-fcgi-perl.c
@@
-214,6
+214,23
@@
static void find_socket_path(void) {
socket_path = m_asprintf("%s/g%s",run_base,ident);
}
socket_path = m_asprintf("%s/g%s",run_base,ident);
}
+static bool check_garbage(void) {
+ struct stat sock_stab, cmd_stab;
+ int r;
+
+ r = lstat(socket_path, &sock_stab);
+ if (r) {
+ if ((errno == ENOENT))
+ return 0; /* well, no garbage then */
+ err(127,"stat socket (%s)",socket_path);
+ }
+
+ r = lstat(command, &cmd_stab);
+ if (r) err(127,"lstat command (%s)",command);
+
+ return 0;
+}
+
int main(int argc, const char *const *argv) {
myopt(&argv, cmdinfos);
int main(int argc, const char *const *argv) {
myopt(&argv, cmdinfos);
@@
-223,6
+240,8
@@
int main(int argc, const char *const *argv) {
find_socket_path();
find_socket_path();
+ check_garbage();
+
printf(">%s<\n",socket_path);
exit(0);
printf(">%s<\n",socket_path);
exit(0);