summaryrefslogtreecommitdiff
path: root/tools/hi-q.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-15 11:41:00 (GMT)
committerJohn Denker <jsd@av8n.com>2012-07-15 11:41:00 (GMT)
commit5b14bc41824ae70d33f1e7cd1486aec32b46b3e1 (patch)
tree3ae1117ee818dea48e302b3c0b5116d565a7691a /tools/hi-q.c
parent536e04ff8c9452ac799c7c53c0414bd3b75f3b56 (diff)
pass group-ID in environment
Diffstat (limited to 'tools/hi-q.c')
-rw-r--r--tools/hi-q.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/hi-q.c b/tools/hi-q.c
index 40d7100..9d85b7a 100644
--- a/tools/hi-q.c
+++ b/tools/hi-q.c
@@ -20,6 +20,7 @@ using namespace std;
#include <sstream>
#include <string>
#include <vector>
+#include <sstream>
// error exit codes, as stated in qmail.c
const int ex_spam = 21;
@@ -126,7 +127,9 @@ int xclose(int arg){
return close(arg);
}
-int main(int argc, char** argv, char const * const * env) {
+extern char** environ;
+
+int main(int argc, char** argv) {
int verbose(1);
int kidstatus;
pid_t somekid;
@@ -339,7 +342,15 @@ int main(int argc, char** argv, char const * const * env) {
close(resync[rEnd]);
close(sync[rEnd]);
close(sync[wEnd]);
- rslt = Execve(prog[0], prog, env);
+
+ stringstream convert;
+ convert << getpgid(0);
+ const string grouper("HI_Q_GROUP=" + convert.str());
+ if (putenv((char*)grouper.c_str()) != 0) {
+ cerr << "putenv failed" << endl;
+ exit(1);
+ }
+ rslt = Execve(prog[0], prog, environ);
fprintf(stderr, "hi-q: failed to exec '%s': ", prog[0]);
perror(0);
exit(ex_syserr);