X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=config%2Fcmd%2Flocktouch.c;fp=config%2Fcmd%2Flocktouch.c;h=da7b86275ec2431506879111a4fa7f2f1d067e66;hb=7df0ddad481bb2e644bba361d0d3defdbd68494e;hp=0000000000000000000000000000000000000000;hpb=d6af9cf30349e4c09b4e9e60342bf1ddd142abd1;p=doldaconnect.git diff --git a/config/cmd/locktouch.c b/config/cmd/locktouch.c new file mode 100644 index 0000000..da7b862 --- /dev/null +++ b/config/cmd/locktouch.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + int fd; + + if(argc < 2) + { + fprintf(stderr, "usage: locktouch lockfile\n"); + exit(1); + } + if((fd = open(argv[1], O_CREAT | O_EXCL, 0666)) < 0) + { + if(errno != EEXIST) + { + perror(argv[1]); + exit(2); + } + exit(1); + } + close(fd); + return(0); +}