summaryrefslogtreecommitdiffstats
path: root/qmail-clean.c
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-02-04 02:36:36 +0100
committermanuel <manuel@mausz.at>2013-02-04 02:36:36 +0100
commit5538f2e0324be41577568029030d097a8a468e6e (patch)
treede5a92a0595d55134f2e58f1db333c43e1b85d00 /qmail-clean.c
parentca6fcdefe9970efe12ae1162d6bd5532e4149a4c (diff)
downloadqmail-5538f2e0324be41577568029030d097a8a468e6e.tar.gz
qmail-5538f2e0324be41577568029030d097a8a468e6e.tar.bz2
qmail-5538f2e0324be41577568029030d097a8a468e6e.zip
[PATCH] big-todo.103
Diffstat (limited to 'qmail-clean.c')
-rw-r--r--qmail-clean.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/qmail-clean.c b/qmail-clean.c
index 7539007..4926f86 100644
--- a/qmail-clean.c
+++ b/qmail-clean.c
@@ -73,22 +73,26 @@ void main()
73 if (line.len < 7) { respond("x"); continue; } 73 if (line.len < 7) { respond("x"); continue; }
74 if (line.len > 100) { respond("x"); continue; } 74 if (line.len > 100) { respond("x"); continue; }
75 if (line.s[line.len - 1]) { respond("x"); continue; } /* impossible */ 75 if (line.s[line.len - 1]) { respond("x"); continue; } /* impossible */
76 for (i = 5;i < line.len - 1;++i) 76 for (i = line.len - 2;i > 4;--i)
77 {
78 if (line.s[i] == '/') break;
77 if ((unsigned char) (line.s[i] - '0') > 9) 79 if ((unsigned char) (line.s[i] - '0') > 9)
78 { respond("x"); continue; } 80 { respond("x"); continue; }
79 if (!scan_ulong(line.s + 5,&id)) { respond("x"); continue; } 81 }
82 if (line.s[i] == '/')
83 if (!scan_ulong(line.s + i + 1,&id)) { respond("x"); continue; }
80 if (byte_equal(line.s,5,"foop/")) 84 if (byte_equal(line.s,5,"foop/"))
81 { 85 {
82#define U(prefix,flag) fmtqfn(fnbuf,prefix,id,flag); \ 86#define U(prefix,flag) fmtqfn(fnbuf,prefix,id,flag); \
83if (unlink(fnbuf) == -1) if (errno != error_noent) { respond("!"); continue; } 87if (unlink(fnbuf) == -1) if (errno != error_noent) { respond("!"); continue; }
84 U("intd/",0) 88 U("intd/",1)
85 U("mess/",1) 89 U("mess/",1)
86 respond("+"); 90 respond("+");
87 } 91 }
88 else if (byte_equal(line.s,4,"todo/")) 92 else if (byte_equal(line.s,4,"todo/"))
89 { 93 {
90 U("intd/",0) 94 U("intd/",1)
91 U("todo/",0) 95 U("todo/",1)
92 respond("+"); 96 respond("+");
93 } 97 }
94 else 98 else