1 /* Author: Peter Vrabec <pvrabec@redhat.com> */
11 #include "prototypes.h"
14 #define MSG_NSCD_FLUSH_CACHE_FAILED "%s: Failed to flush the nscd cache.\n"
17 * nscd_flush_cache - flush specified service buffer in nscd cache
19 int nscd_flush_cache (const char *service)
22 const char *cmd = "/usr/sbin/nscd";
23 const char *spawnedArgs[] = {"nscd", "-i", service, NULL};
24 const char *spawnedEnv[] = {NULL};
26 if (run_command (cmd, spawnedArgs, spawnedEnv, &status) != 0) {
27 /* run_command writes its own more detailed message. */
28 (void) fprintf (stderr, _(MSG_NSCD_FLUSH_CACHE_FAILED), Prog);
32 code = WEXITSTATUS (status);
33 if (!WIFEXITED (status)) {
34 (void) fprintf (stderr,
35 _("%s: nscd did not terminate normally (signal %d)\n"),
36 Prog, WTERMSIG (status));
38 } else if (code == E_CMD_NOTFOUND) {
39 /* nscd is not installed, or it is installed but uses an
40 interpreter that is missing. Probably the former. */
42 } else if (code != 0) {
43 (void) fprintf (stderr, _("%s: nscd exited with status %d"),
45 (void) fprintf (stderr, _(MSG_NSCD_FLUSH_CACHE_FAILED), Prog);
52 extern int errno; /* warning: ANSI C forbids an empty source file */