annotate defaults/hg-wrapper.cpp @ 12:e056798af879

fixing problem with shell interpretation.
author Robert McIntyre <rlm@mit.edu>
date Wed, 09 Jan 2013 07:09:37 +0000
parents 389f8678f1d8
children
rev   line source
rlm@9 1 #include <cstdlib>
rlm@9 2 #include <vector>
rlm@9 3 #include <string>
rlm@9 4 #include <unistd.h>
rlm@9 5 #include <boost/algorithm/string/join.hpp>
rlm@9 6
rlm@11 7 /** This a simple wrapper script to call
rlm@11 8 mercurial as a semi-privleged user. */
rlm@11 9
rlm@9 10 main( int argc, char ** argv){
rlm@9 11 std::vector<std::string> input(argv, argv+argc);
rlm@9 12 input[0] = std::string("hg");
rlm@9 13 std::string command = boost::algorithm::join(input, " ");
rlm@11 14 setreuid(geteuid(), geteuid());
rlm@12 15 setregid(getegid(), getegid());
rlm@9 16 return system(command.c_str());
rlm@9 17 }