Squid Web Cache
master
Loading...
Searching...
No Matches
unlinkd_daemon.cc
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3
*
4
* Squid software is distributed under GPLv2+ license and includes
5
* contributions from numerous individuals and organizations.
6
* Please see the COPYING and CONTRIBUTORS files for details.
7
*/
8
9
/* DEBUG: section -- Unlink Daemon */
10
11
#define SQUID_HELPER 1
12
13
#include "
squid.h
"
14
15
#include "
compat/unistd.h
"
16
17
#include <iostream>
18
#include <cstdio>
19
#if HAVE_PATHS_H
20
#include <paths.h>
21
#endif
22
34
#define UNLINK_BUF_LEN 1024
35
53
int
54
main
(
int
,
char
*[])
55
{
56
std::string sbuf;
57
close(2);
58
if
(
xopen
(_PATH_DEVNULL, O_RDWR) < 0) {
59
;
// the irony of having to close(2) earlier is that we cannot report this failure.
60
}
61
while
(getline(std::cin, sbuf)) {
62
// tailing newline is removed by getline
63
const
int
rv = remove(sbuf.c_str());
64
if
(rv < 0)
65
std::cout <<
"ERR"
<< std::endl;
// endl flushes
66
else
67
std::cout <<
"OK"
<< std::endl;
68
}
69
70
return
EXIT_SUCCESS;
71
}
72
main
int main()
Definition
kerberos_ldap_group.cc:492
squid.h
unistd.h
xopen
int xopen(const char *filename, int oflag, int pmode=0)
POSIX open(2) equivalent.
Definition
unistd.h:55
squid
src
unlinkd_daemon.cc
Generated by
1.9.8