2017-11-20 19:49:47 +00:00
|
|
|
/*-
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*
|
1996-05-05 14:04:33 +00:00
|
|
|
* Copyright (c) 1983, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2017-02-28 23:42:47 +00:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1996-05-05 14:04:33 +00:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
1997-09-24 06:48:24 +00:00
|
|
|
#if 0
|
2003-07-14 20:20:58 +00:00
|
|
|
#ifndef lint
|
1996-05-05 22:40:51 +00:00
|
|
|
static char sccsid[] = "@(#)rmjob.c 8.2 (Berkeley) 4/28/95";
|
2003-07-14 20:20:58 +00:00
|
|
|
#endif /* not lint */
|
1997-09-24 06:48:24 +00:00
|
|
|
#endif
|
2003-07-14 20:20:58 +00:00
|
|
|
|
2003-07-14 05:15:21 +00:00
|
|
|
#include "lp.cdefs.h" /* A cross-platform version of <sys/cdefs.h> */
|
|
|
|
__FBSDID("$FreeBSD$");
|
1996-05-05 14:04:33 +00:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
1997-12-02 20:46:22 +00:00
|
|
|
#include <sys/uio.h>
|
1996-05-05 14:04:33 +00:00
|
|
|
|
1997-12-02 20:46:22 +00:00
|
|
|
#include <ctype.h>
|
1996-05-05 14:04:33 +00:00
|
|
|
#include <dirent.h>
|
2012-10-22 03:31:22 +00:00
|
|
|
#include <err.h>
|
1997-12-02 20:46:22 +00:00
|
|
|
#include <errno.h>
|
|
|
|
#include <signal.h>
|
1996-05-05 14:04:33 +00:00
|
|
|
#include <stdio.h>
|
1997-12-02 20:46:22 +00:00
|
|
|
#include <stdlib.h>
|
1996-05-05 14:04:33 +00:00
|
|
|
#include <string.h>
|
1997-12-02 20:46:22 +00:00
|
|
|
#define psignal foil_gcc_psignal
|
|
|
|
#define sys_siglist foil_gcc_siglist
|
|
|
|
#include <unistd.h>
|
|
|
|
#undef psignal
|
|
|
|
#undef sys_siglist
|
|
|
|
|
1996-05-05 14:04:33 +00:00
|
|
|
#include "lp.h"
|
|
|
|
#include "lp.local.h"
|
|
|
|
#include "pathnames.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* rmjob - remove the specified jobs from the queue.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Stuff for handling lprm specifications
|
|
|
|
*/
|
|
|
|
static char root[] = "root";
|
|
|
|
static int all = 0; /* eliminate all files (root only) */
|
|
|
|
static int cur_daemon; /* daemon's pid */
|
2000-11-05 03:21:57 +00:00
|
|
|
static char current[7+MAXHOSTNAMELEN]; /* active control file name */
|
1996-05-05 14:04:33 +00:00
|
|
|
|
2001-06-12 16:38:20 +00:00
|
|
|
static void alarmhandler(int _signo);
|
|
|
|
static void do_unlink(char *_file);
|
2004-12-31 00:36:28 +00:00
|
|
|
static int isowner(char *_owner, char *_file, const char *_cfhost);
|
1997-07-23 00:49:46 +00:00
|
|
|
|
1996-05-05 14:04:33 +00:00
|
|
|
void
|
2001-06-12 16:38:20 +00:00
|
|
|
rmjob(const char *printer)
|
1996-05-05 14:04:33 +00:00
|
|
|
{
|
|
|
|
register int i, nitems;
|
2011-12-30 10:58:14 +00:00
|
|
|
int assassinated = 0;
|
1996-05-05 14:04:33 +00:00
|
|
|
struct dirent **files;
|
|
|
|
char *cp;
|
1997-12-02 20:46:22 +00:00
|
|
|
struct printer myprinter, *pp = &myprinter;
|
1996-05-05 14:04:33 +00:00
|
|
|
|
1997-12-02 20:46:22 +00:00
|
|
|
init_printer(pp);
|
|
|
|
if ((i = getprintcap(printer, pp)) < 0)
|
|
|
|
fatal(pp, "getprintcap: %s", pcaperr(i));
|
|
|
|
if ((cp = checkremote(pp))) {
|
1996-05-05 14:04:33 +00:00
|
|
|
printf("Warning: %s\n", cp);
|
1997-12-02 20:46:22 +00:00
|
|
|
free(cp);
|
|
|
|
}
|
1996-05-05 14:04:33 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If the format was `lprm -' and the user isn't the super-user,
|
|
|
|
* then fake things to look like he said `lprm user'.
|
|
|
|
*/
|
|
|
|
if (users < 0) {
|
|
|
|
if (getuid() == 0)
|
|
|
|
all = 1; /* all files in local queue */
|
|
|
|
else {
|
|
|
|
user[0] = person;
|
|
|
|
users = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!strcmp(person, "-all")) {
|
2001-06-15 22:03:07 +00:00
|
|
|
if (from_host == local_host)
|
1997-12-02 20:46:22 +00:00
|
|
|
fatal(pp, "The login name \"-all\" is reserved");
|
2001-06-15 22:03:07 +00:00
|
|
|
all = 1; /* all those from 'from_host' */
|
1996-05-05 14:04:33 +00:00
|
|
|
person = root;
|
|
|
|
}
|
|
|
|
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_START
|
1997-12-02 20:46:22 +00:00
|
|
|
if (chdir(pp->spool_dir) < 0)
|
|
|
|
fatal(pp, "cannot chdir to spool directory");
|
1996-05-05 14:04:33 +00:00
|
|
|
if ((nitems = scandir(".", &files, iscf, NULL)) < 0)
|
1997-12-02 20:46:22 +00:00
|
|
|
fatal(pp, "cannot access spool directory");
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_END
|
1996-05-05 14:04:33 +00:00
|
|
|
|
|
|
|
if (nitems) {
|
|
|
|
/*
|
|
|
|
* Check for an active printer daemon (in which case we
|
|
|
|
* kill it if it is reading our file) then remove stuff
|
|
|
|
* (after which we have to restart the daemon).
|
|
|
|
*/
|
1997-12-02 20:46:22 +00:00
|
|
|
if (lockchk(pp, pp->lock_file) && chk(current)) {
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_START
|
2011-12-30 10:58:14 +00:00
|
|
|
assassinated = kill(cur_daemon, SIGINT) == 0;
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_END
|
2011-12-30 10:58:14 +00:00
|
|
|
if (!assassinated)
|
1997-12-02 20:46:22 +00:00
|
|
|
fatal(pp, "cannot kill printer daemon");
|
1996-05-05 14:04:33 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* process the files
|
|
|
|
*/
|
|
|
|
for (i = 0; i < nitems; i++)
|
1997-12-02 20:46:22 +00:00
|
|
|
process(pp, files[i]->d_name);
|
1996-05-05 14:04:33 +00:00
|
|
|
}
|
1997-12-02 20:46:22 +00:00
|
|
|
rmremote(pp);
|
1996-05-05 14:04:33 +00:00
|
|
|
/*
|
|
|
|
* Restart the printer daemon if it was killed
|
|
|
|
*/
|
2011-12-30 10:58:14 +00:00
|
|
|
if (assassinated && !startdaemon(pp))
|
1997-12-02 20:46:22 +00:00
|
|
|
fatal(pp, "cannot restart printer daemon\n");
|
1996-05-05 14:04:33 +00:00
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process a lock file: collect the pid of the active
|
|
|
|
* daemon and the file name of the active spool entry.
|
|
|
|
* Return boolean indicating existence of a lock file.
|
|
|
|
*/
|
|
|
|
int
|
2001-06-12 16:38:20 +00:00
|
|
|
lockchk(struct printer *pp, char *slockf)
|
1996-05-05 14:04:33 +00:00
|
|
|
{
|
|
|
|
register FILE *fp;
|
|
|
|
register int i, n;
|
|
|
|
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_START
|
2001-06-12 16:38:20 +00:00
|
|
|
if ((fp = fopen(slockf, "r")) == NULL) {
|
1996-05-05 14:04:33 +00:00
|
|
|
if (errno == EACCES)
|
2001-06-12 16:38:20 +00:00
|
|
|
fatal(pp, "%s: %s", slockf, strerror(errno));
|
1996-05-05 14:04:33 +00:00
|
|
|
else
|
|
|
|
return(0);
|
1997-07-23 00:49:46 +00:00
|
|
|
}
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_END
|
2016-05-10 11:17:19 +00:00
|
|
|
if (!get_line(fp)) {
|
1996-05-05 14:04:33 +00:00
|
|
|
(void) fclose(fp);
|
|
|
|
return(0); /* no daemon present */
|
|
|
|
}
|
|
|
|
cur_daemon = atoi(line);
|
1997-07-23 00:49:46 +00:00
|
|
|
if (kill(cur_daemon, 0) < 0 && errno != EPERM) {
|
1996-05-05 14:04:33 +00:00
|
|
|
(void) fclose(fp);
|
|
|
|
return(0); /* no daemon present */
|
|
|
|
}
|
|
|
|
for (i = 1; (n = fread(current, sizeof(char), sizeof(current), fp)) <= 0; i++) {
|
|
|
|
if (i > 5) {
|
|
|
|
n = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
sleep(i);
|
|
|
|
}
|
|
|
|
current[n-1] = '\0';
|
|
|
|
(void) fclose(fp);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process a control file.
|
|
|
|
*/
|
|
|
|
void
|
2001-06-12 16:38:20 +00:00
|
|
|
process(const struct printer *pp, char *file)
|
1996-05-05 14:04:33 +00:00
|
|
|
{
|
|
|
|
FILE *cfp;
|
|
|
|
|
|
|
|
if (!chk(file))
|
|
|
|
return;
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_START
|
1996-05-05 14:04:33 +00:00
|
|
|
if ((cfp = fopen(file, "r")) == NULL)
|
1997-12-02 20:46:22 +00:00
|
|
|
fatal(pp, "cannot open %s", file);
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_END
|
2016-05-10 11:17:19 +00:00
|
|
|
while (get_line(cfp)) {
|
1996-05-05 14:04:33 +00:00
|
|
|
switch (line[0]) {
|
|
|
|
case 'U': /* unlink associated files */
|
1997-07-18 18:33:15 +00:00
|
|
|
if (strchr(line+1, '/') || strncmp(line+1, "df", 2))
|
|
|
|
break;
|
1997-07-23 00:49:46 +00:00
|
|
|
do_unlink(line+1);
|
1996-05-05 14:04:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
(void) fclose(cfp);
|
1997-07-23 00:49:46 +00:00
|
|
|
do_unlink(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-06-12 16:38:20 +00:00
|
|
|
do_unlink(char *file)
|
1997-07-23 00:49:46 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2001-06-15 22:03:07 +00:00
|
|
|
if (from_host != local_host)
|
|
|
|
printf("%s: ", local_host);
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_START
|
1997-07-23 00:49:46 +00:00
|
|
|
ret = unlink(file);
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_END
|
1997-07-23 00:49:46 +00:00
|
|
|
printf(ret ? "cannot dequeue %s\n" : "%s dequeued\n", file);
|
1996-05-05 14:04:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do the dirty work in checking
|
|
|
|
*/
|
|
|
|
int
|
2001-06-12 16:38:20 +00:00
|
|
|
chk(char *file)
|
1996-05-05 14:04:33 +00:00
|
|
|
{
|
2004-12-31 00:36:28 +00:00
|
|
|
int *r, jnum;
|
|
|
|
char **u;
|
|
|
|
const char *cfhost;
|
1996-05-05 14:04:33 +00:00
|
|
|
FILE *cfp;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check for valid cf file name (mostly checking current).
|
|
|
|
*/
|
|
|
|
if (strlen(file) < 7 || file[0] != 'c' || file[1] != 'f')
|
|
|
|
return(0);
|
|
|
|
|
2004-12-31 00:36:28 +00:00
|
|
|
jnum = calc_jobnum(file, &cfhost);
|
|
|
|
if (all && (from_host == local_host || !strcmp(from_host, cfhost)))
|
1996-05-05 14:04:33 +00:00
|
|
|
return(1);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* get the owner's name from the control file.
|
|
|
|
*/
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_START
|
1996-05-05 14:04:33 +00:00
|
|
|
if ((cfp = fopen(file, "r")) == NULL)
|
|
|
|
return(0);
|
2012-10-22 03:31:22 +00:00
|
|
|
PRIV_END
|
2016-05-10 11:17:19 +00:00
|
|
|
while (get_line(cfp)) {
|
1996-05-05 14:04:33 +00:00
|
|
|
if (line[0] == 'P')
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
(void) fclose(cfp);
|
|
|
|
if (line[0] != 'P')
|
|
|
|
return(0);
|
|
|
|
|
|
|
|
if (users == 0 && requests == 0)
|
2004-12-31 00:36:28 +00:00
|
|
|
return(!strcmp(file, current) && isowner(line+1, file, cfhost));
|
1996-05-05 14:04:33 +00:00
|
|
|
/*
|
|
|
|
* Check the request list
|
|
|
|
*/
|
|
|
|
for (r = requ; r < &requ[requests]; r++)
|
2004-12-31 00:36:28 +00:00
|
|
|
if (*r == jnum && isowner(line+1, file, cfhost))
|
1996-05-05 14:04:33 +00:00
|
|
|
return(1);
|
|
|
|
/*
|
|
|
|
* Check to see if it's in the user list
|
|
|
|
*/
|
|
|
|
for (u = user; u < &user[users]; u++)
|
2004-12-31 00:36:28 +00:00
|
|
|
if (!strcmp(*u, line+1) && isowner(line+1, file, cfhost))
|
1996-05-05 14:04:33 +00:00
|
|
|
return(1);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If root is removing a file on the local machine, allow it.
|
|
|
|
* If root is removing a file from a remote machine, only allow
|
|
|
|
* files sent from the remote machine to be removed.
|
|
|
|
* Normal users can only remove the file from where it was sent.
|
|
|
|
*/
|
2004-12-31 00:36:28 +00:00
|
|
|
static int
|
|
|
|
isowner(char *owner, char *file, const char *cfhost)
|
1996-05-05 14:04:33 +00:00
|
|
|
{
|
2001-06-15 22:03:07 +00:00
|
|
|
if (!strcmp(person, root) && (from_host == local_host ||
|
2004-12-31 00:36:28 +00:00
|
|
|
!strcmp(from_host, cfhost)))
|
2001-06-12 16:38:20 +00:00
|
|
|
return (1);
|
2004-12-31 00:36:28 +00:00
|
|
|
if (!strcmp(person, owner) && !strcmp(from_host, cfhost))
|
2001-06-12 16:38:20 +00:00
|
|
|
return (1);
|
2001-06-15 22:03:07 +00:00
|
|
|
if (from_host != local_host)
|
|
|
|
printf("%s: ", local_host);
|
1996-05-05 14:04:33 +00:00
|
|
|
printf("%s: Permission denied\n", file);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if we are sending files to a remote machine. If we are,
|
|
|
|
* then try removing files on the remote machine.
|
|
|
|
*/
|
|
|
|
void
|
2001-06-12 16:38:20 +00:00
|
|
|
rmremote(const struct printer *pp)
|
1996-05-05 14:04:33 +00:00
|
|
|
{
|
2001-03-12 01:16:09 +00:00
|
|
|
int i, elem, firstreq, niov, rem, totlen;
|
1996-05-05 14:04:33 +00:00
|
|
|
char buf[BUFSIZ];
|
1997-10-14 16:01:02 +00:00
|
|
|
void (*savealrm)(int);
|
1997-12-02 20:46:22 +00:00
|
|
|
struct iovec *iov;
|
1996-05-05 14:04:33 +00:00
|
|
|
|
1997-12-02 20:46:22 +00:00
|
|
|
if (!pp->remote)
|
1996-05-05 14:04:33 +00:00
|
|
|
return; /* not sending to a remote machine */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Flush stdout so the user can see what has been deleted
|
|
|
|
* while we wait (possibly) for the connection.
|
|
|
|
*/
|
|
|
|
fflush(stdout);
|
|
|
|
|
1997-12-02 20:46:22 +00:00
|
|
|
/*
|
|
|
|
* Counting:
|
|
|
|
* 4 == "\5" + remote_queue + " " + person
|
|
|
|
* 2 * users == " " + user[i] for each user
|
|
|
|
* requests == asprintf results for each request
|
|
|
|
* 1 == "\n"
|
|
|
|
* Although laborious, doing it this way makes it possible for
|
|
|
|
* us to process requests of indeterminate length without
|
|
|
|
* applying an arbitrary limit. Arbitrary Limits Are Bad (tm).
|
|
|
|
*/
|
2001-03-12 01:16:09 +00:00
|
|
|
if (users > 0)
|
|
|
|
niov = 4 + 2 * users + requests + 1;
|
|
|
|
else
|
|
|
|
niov = 4 + requests + 1;
|
1997-12-02 20:46:22 +00:00
|
|
|
iov = malloc(niov * sizeof *iov);
|
2016-04-10 23:47:40 +00:00
|
|
|
if (iov == NULL)
|
2001-03-12 01:16:09 +00:00
|
|
|
fatal(pp, "out of memory in rmremote()");
|
1997-12-02 20:46:22 +00:00
|
|
|
iov[0].iov_base = "\5";
|
|
|
|
iov[1].iov_base = pp->remote_queue;
|
|
|
|
iov[2].iov_base = " ";
|
|
|
|
iov[3].iov_base = all ? "-all" : person;
|
2001-03-12 01:16:09 +00:00
|
|
|
elem = 4;
|
1997-12-02 20:46:22 +00:00
|
|
|
for (i = 0; i < users; i++) {
|
2001-03-12 01:16:09 +00:00
|
|
|
iov[elem].iov_base = " ";
|
|
|
|
iov[elem + 1].iov_base = user[i];
|
|
|
|
elem += 2;
|
1996-05-05 14:04:33 +00:00
|
|
|
}
|
2001-03-12 01:16:09 +00:00
|
|
|
firstreq = elem;
|
1997-12-02 20:46:22 +00:00
|
|
|
for (i = 0; i < requests; i++) {
|
2003-10-26 03:01:24 +00:00
|
|
|
asprintf((char **)&iov[elem].iov_base, " %d", requ[i]);
|
2001-03-12 01:16:09 +00:00
|
|
|
if (iov[elem].iov_base == 0)
|
|
|
|
fatal(pp, "out of memory in rmremote()");
|
|
|
|
elem++;
|
1996-05-05 14:04:33 +00:00
|
|
|
}
|
2001-03-12 01:16:09 +00:00
|
|
|
iov[elem++].iov_base = "\n";
|
1997-12-02 20:46:22 +00:00
|
|
|
for (totlen = i = 0; i < niov; i++)
|
|
|
|
totlen += (iov[i].iov_len = strlen(iov[i].iov_base));
|
|
|
|
|
1997-10-14 16:01:02 +00:00
|
|
|
savealrm = signal(SIGALRM, alarmhandler);
|
1997-12-02 20:46:22 +00:00
|
|
|
alarm(pp->conn_timeout);
|
|
|
|
rem = getport(pp, pp->remote_host, 0);
|
1997-10-14 16:01:02 +00:00
|
|
|
(void)signal(SIGALRM, savealrm);
|
1996-05-05 14:04:33 +00:00
|
|
|
if (rem < 0) {
|
2001-06-15 22:03:07 +00:00
|
|
|
if (from_host != local_host)
|
|
|
|
printf("%s: ", local_host);
|
1997-12-02 20:46:22 +00:00
|
|
|
printf("connection to %s is down\n", pp->remote_host);
|
1996-05-05 14:04:33 +00:00
|
|
|
} else {
|
1997-12-02 20:46:22 +00:00
|
|
|
if (writev(rem, iov, niov) != totlen)
|
|
|
|
fatal(pp, "Lost connection");
|
1996-05-05 14:04:33 +00:00
|
|
|
while ((i = read(rem, buf, sizeof(buf))) > 0)
|
|
|
|
(void) fwrite(buf, 1, i, stdout);
|
|
|
|
(void) close(rem);
|
|
|
|
}
|
1997-12-02 20:46:22 +00:00
|
|
|
for (i = 0; i < requests; i++)
|
2001-03-12 01:16:09 +00:00
|
|
|
free(iov[firstreq + i].iov_base);
|
1997-12-02 20:46:22 +00:00
|
|
|
free(iov);
|
1996-05-05 14:04:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return 1 if the filename begins with 'cf'
|
|
|
|
*/
|
|
|
|
int
|
2010-01-04 15:40:17 +00:00
|
|
|
iscf(const struct dirent *d)
|
1996-05-05 14:04:33 +00:00
|
|
|
{
|
|
|
|
return(d->d_name[0] == 'c' && d->d_name[1] == 'f');
|
|
|
|
}
|
1997-10-14 16:01:02 +00:00
|
|
|
|
|
|
|
void
|
2001-06-12 16:38:20 +00:00
|
|
|
alarmhandler(int signo __unused)
|
1997-10-14 16:01:02 +00:00
|
|
|
{
|
2001-06-12 16:38:20 +00:00
|
|
|
/* the signal is ignored */
|
|
|
|
/* (the '__unused' is just to avoid a compile-time warning) */
|
1997-10-14 16:01:02 +00:00
|
|
|
}
|