2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 1991-1998 University of Maryland at College Park
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of U.M. not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission. U.M. makes no representations about the
13 * suitability of this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
16 * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
18 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Author: James da Silva, Systems Design and Analysis Group
24 * Computer Science Department
25 * University of Maryland at College Park
28 * $Id: driverio.c,v 1.92 2006/08/24 01:57:16 paddy_s Exp $
30 * I/O-related functions for driver program
35 #include "server_util.h"
40 #include "timestamp.h"
42 #define GLOBAL /* the global variables defined here */
47 static const char *childstr(int);
56 for(dumper = dmptable; dumper < dmptable + MAX_DUMPERS; dumper++) {
66 static char buf[NUM_STR_SIZE + 32];
72 for (dumper = dmptable; dumper < dmptable + MAX_DUMPERS; dumper++) {
74 return (dumper->name);
75 if (dumper->chunker && dumper->chunker->fd == fd)
76 return (dumper->chunker->name);
78 g_snprintf(buf, SIZEOF(buf), _("unknown child (fd %d)"), fd);
86 int taper_parallel_write,
91 char **config_options;
94 /* always allocate the tapetable */
95 tapetable = calloc(sizeof(taper_t), taper_parallel_write+1);
97 for (taper = tapetable, i = 0; i < taper_parallel_write; taper++, i++) {
98 taper->name = g_strdup_printf("worker%d", i);
99 taper->sendresult = 0;
100 taper->input_error = NULL;
101 taper->tape_error = NULL;
103 taper->dumper = NULL;
105 taper->first_label = NULL;
106 taper->first_fileno = 0;
107 taper->state = TAPER_STATE_DEFAULT;
111 /* jump right to degraded mode if there's no taper */
113 taper->tape_error = g_strdup("no taper started (--no-taper)");
114 taper->result = BOGUS;
118 /* don't start the taper if we're not supposed to */
122 if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd) == -1) {
123 error(_("taper pipe: %s"), strerror(errno));
126 if(fd[0] < 0 || fd[0] >= (int)FD_SETSIZE) {
127 error(_("taper socketpair 0: descriptor %d out of range (0 .. %d)\n"),
128 fd[0], (int)FD_SETSIZE-1);
131 if(fd[1] < 0 || fd[1] >= (int)FD_SETSIZE) {
132 error(_("taper socketpair 1: descriptor %d out of range (0 .. %d)\n"),
133 fd[1], (int)FD_SETSIZE-1);
137 switch(taper_pid = fork()) {
139 error(_("fork taper: %s"), strerror(errno));
142 case 0: /* child process */
144 if(dup2(fd[1], 0) == -1 || dup2(fd[1], 1) == -1)
145 error(_("taper dup2: %s"), strerror(errno));
146 config_options = get_config_options(2);
147 config_options[0] = "taper";
148 config_options[1] = get_config_name();
150 execve(taper_program, config_options, safe_env());
151 error("exec %s: %s", taper_program, strerror(errno));
154 default: /* parent process */
157 taper_ev_read = NULL;
162 startup_dump_process(
164 char *dumper_program)
167 char **config_options;
169 if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd) == -1) {
170 error(_("%s pipe: %s"), dumper->name, strerror(errno));
174 switch(dumper->pid = fork()) {
176 error(_("fork %s: %s"), dumper->name, strerror(errno));
179 case 0: /* child process */
181 if(dup2(fd[1], 0) == -1 || dup2(fd[1], 1) == -1)
182 error(_("%s dup2: %s"), dumper->name, strerror(errno));
183 config_options = get_config_options(2);
184 config_options[0] = dumper->name ? dumper->name : "dumper",
185 config_options[1] = get_config_name();
187 execve(dumper_program, config_options, safe_env());
188 error(_("exec %s (%s): %s"), dumper_program,
189 dumper->name, strerror(errno));
192 default: /* parent process */
195 dumper->ev_read = NULL;
196 dumper->busy = dumper->down = 0;
198 g_fprintf(stderr,_("driver: started %s pid %u\n"),
199 dumper->name, (unsigned)dumper->pid);
205 startup_dump_processes(
206 char *dumper_program,
212 char number[NUM_STR_SIZE];
214 for(dumper = dmptable, i = 0; i < inparallel; dumper++, i++) {
215 g_snprintf(number, SIZEOF(number), "%d", i);
216 dumper->name = stralloc2("dumper", number);
217 dumper->chunker = &chktable[i];
218 chktable[i].name = stralloc2("chunker", number);
219 chktable[i].dumper = dumper;
222 startup_dump_process(dumper, dumper_program);
223 dumper_cmd(dumper, START, NULL, (void *)timestamp);
228 startup_chunk_process(
230 char *chunker_program)
233 char **config_options;
235 if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd) == -1) {
236 error(_("%s pipe: %s"), chunker->name, strerror(errno));
240 switch(chunker->pid = fork()) {
242 error(_("fork %s: %s"), chunker->name, strerror(errno));
245 case 0: /* child process */
247 if(dup2(fd[1], 0) == -1 || dup2(fd[1], 1) == -1) {
248 error(_("%s dup2: %s"), chunker->name, strerror(errno));
251 config_options = get_config_options(2);
252 config_options[0] = chunker->name ? chunker->name : "chunker",
253 config_options[1] = get_config_name();
255 execve(chunker_program, config_options, safe_env());
256 error(_("exec %s (%s): %s"), chunker_program,
257 chunker->name, strerror(errno));
260 default: /* parent process */
264 chunker->ev_read = NULL;
265 g_fprintf(stderr,_("driver: started %s pid %u\n"),
266 chunker->name, (unsigned)chunker->pid);
281 if((line = areads(fd)) == NULL) {
283 g_fprintf(stderr, _("reading result from %s: %s"), childstr(fd), strerror(errno));
286 *result_argc = 0; /* EOF */
288 *result_argv = split_quoted_strings(line);
289 *result_argc = g_strv_length(*result_argv);
293 g_printf(_("driver: result time %s from %s:"),
294 walltime_str(curclock()),
297 g_printf(" %s", line);
300 g_printf(" (eof)\n");
306 if(*result_argc < 1) return BOGUS;
308 for(t = (cmd_t)(BOGUS+1); t < LAST_TOK; t++)
309 if(strcmp((*result_argv)[0], cmdstr[t]) == 0) return t;
316 taper_splitting_args(
319 GString *args = NULL;
321 dumptype_t *dt = dp->config;
324 tt = lookup_tapetype(getconf_str(CNF_TAPETYPE));
325 g_assert(tt != NULL);
327 args = g_string_new("");
329 /* old dumptype-based parameters, using empty strings when not seen */
330 if (dt) { /* 'dt' may be NULL for flushes */
331 if (dumptype_seen(dt, DUMPTYPE_TAPE_SPLITSIZE)) {
332 g_string_append_printf(args, "%ju ",
333 (uintmax_t)dumptype_get_tape_splitsize(dt)*1024);
335 g_string_append(args, "\"\" ");
338 q = quote_string(dumptype_seen(dt, DUMPTYPE_SPLIT_DISKBUFFER)?
339 dumptype_get_split_diskbuffer(dt) : "");
340 g_string_append_printf(args, "%s ", q);
343 if (dumptype_seen(dt, DUMPTYPE_FALLBACK_SPLITSIZE)) {
344 g_string_append_printf(args, "%ju ",
345 (uintmax_t)dumptype_get_fallback_splitsize(dt)*1024);
347 g_string_append(args, "\"\" ");
350 if (dumptype_seen(dt, DUMPTYPE_ALLOW_SPLIT)) {
351 g_string_append_printf(args, "%d ",
352 (int)dumptype_get_allow_split(dt));
354 g_string_append(args, "\"\" ");
357 g_string_append(args, "\"\" \"\" \"\" \"\" ");
360 /* new tapetype-based parameters */
361 if (tapetype_seen(tt, TAPETYPE_PART_SIZE)) {
362 g_string_append_printf(args, "%ju ",
363 (uintmax_t)tapetype_get_part_size(tt)*1024);
365 g_string_append(args, "\"\" ");
369 if (tapetype_seen(tt, TAPETYPE_PART_CACHE_TYPE)) {
370 switch (tapetype_get_part_cache_type(tt)) {
372 case PART_CACHE_TYPE_NONE:
376 case PART_CACHE_TYPE_MEMORY:
380 case PART_CACHE_TYPE_DISK:
386 g_string_append_printf(args, "%s ", q);
389 q = quote_string(tapetype_seen(tt, TAPETYPE_PART_CACHE_DIR)?
390 tapetype_get_part_cache_dir(tt) : "");
391 g_string_append_printf(args, "%s ", q);
394 if (tapetype_seen(tt, TAPETYPE_PART_CACHE_MAX_SIZE)) {
395 g_string_append_printf(args, "%ju ",
396 (uintmax_t)tapetype_get_part_cache_max_size(tt)*1024);
398 g_string_append(args, "\"\" ");
402 return g_string_free(args, FALSE);
413 char *cmdline = NULL;
414 char number[NUM_STR_SIZE];
415 char orig_kb[NUM_STR_SIZE];
426 cmdline = vstralloc(cmdstr[cmd],
433 cmdline = g_strjoin(NULL, cmdstr[cmd],
434 " ", sched(dp)->taper->name,
439 qname = quote_string(dp->name);
440 qdest = quote_string(destname);
441 g_snprintf(number, SIZEOF(number), "%d", level);
442 if (sched(dp)->origsize >= 0)
443 origsize = sched(dp)->origsize;
446 g_snprintf(orig_kb, SIZEOF(orig_kb), "%ju", origsize);
447 splitargs = taper_splitting_args(dp);
448 cmdline = vstralloc(cmdstr[cmd],
449 " ", sched(dp)->taper->name,
450 " ", disk2serial(dp),
452 " ", dp->host->hostname,
466 qname = quote_string(dp->name);
467 g_snprintf(number, SIZEOF(number), "%d", level);
468 data_path = data_path_to_string(dp->data_path);
471 If we haven't been given a place to buffer split dumps to disk,
472 make the argument something besides and empty string so's taper
475 splitargs = taper_splitting_args(dp);
476 cmdline = vstralloc(cmdstr[cmd],
477 " ", sched(dp)->taper->name,
478 " ", disk2serial(dp),
479 " ", dp->host->hostname,
489 case DONE: /* handle */
491 if (sched(dp)->origsize >= 0)
492 origsize = sched(dp)->origsize;
495 g_snprintf(number, SIZEOF(number), "%ju", origsize);
496 cmdline = vstralloc(cmdstr[cmd],
497 " ", sched(dp)->taper->name,
498 " ", disk2serial(dp),
502 case FAILED: /* handle */
504 cmdline = vstralloc(cmdstr[cmd],
505 " ", sched(dp)->taper->name,
506 " ", disk2serial(dp),
511 q = quote_string(destname); /* reason why no new tape */
512 cmdline = vstralloc(cmdstr[cmd],
513 " ", sched(dp)->taper->name,
514 " ", disk2serial(dp),
521 cmdline = vstralloc(cmdstr[cmd],
522 " ", sched(dp)->taper->name,
523 " ", disk2serial(dp),
528 cmdline = vstralloc(cmdstr[cmd],
529 " ", sched(dp)->taper->name,
530 " ", disk2serial(dp),
533 case TAKE_SCRIBE_FROM:
535 cmdline = vstralloc(cmdstr[cmd],
536 " ", sched(dp)->taper->name,
537 " ", disk2serial(dp),
538 " ", destname, /* name of worker */
542 cmdline = stralloc2(cmdstr[cmd], "\n");
545 error(_("Don't know how to send %s command to taper"), cmdstr[cmd]);
550 * Note: cmdline already has a '\n'.
552 g_printf(_("driver: send-cmd time %s to taper: %s"),
553 walltime_str(curclock()), cmdline);
555 if ((full_write(taper_fd, cmdline, strlen(cmdline))) < strlen(cmdline)) {
556 g_printf(_("writing taper command '%s' failed: %s\n"),
557 cmdline, strerror(errno));
562 if(cmd == QUIT) aclose(taper_fd);
574 char *cmdline = NULL;
575 char number[NUM_STR_SIZE];
576 char numberport[NUM_STR_SIZE];
585 cmdline = vstralloc(cmdstr[cmd], " ", mesg, "\n", NULL);
588 if(dp && dp->device) {
596 application_t *application = NULL;
600 char *qclient_username;
605 if (dp->application != NULL) {
606 application = lookup_application(dp->application);
607 g_assert(application != NULL);
610 device = quote_string((dp->device) ? dp->device : "NODEVICE");
611 qname = quote_string(dp->name);
612 g_snprintf(number, SIZEOF(number), "%d", sched(dp)->level);
613 g_snprintf(numberport, SIZEOF(numberport), "%d", dumper->output_port);
614 features = am_feature_to_string(dp->host->features);
615 if (am_has_feature(dp->host->features, fe_req_xml)) {
616 o = xml_optionstr(dp, 1);
618 d_prop = xml_dumptype_properties(dp);
619 vstrextend(&o, d_prop, NULL);
624 xml_app = xml_application(dp, application,
626 vstrextend(&o, xml_app, NULL);
629 oo = quote_string(o);
636 g_assert(dp->program);
637 if (0 == strcmp(dp->program, "APPLICATION")) {
638 g_assert(application != NULL);
639 plugin = application_get_plugin(application);
641 plugin = dp->program;
643 qplugin = quote_string(plugin);
644 qamandad_path = quote_string(dp->amandad_path);
645 qclient_username = quote_string(dp->client_username);
646 qclient_port = quote_string(dp->client_port);
647 qssh_keys = quote_string(dp->ssh_keys);
648 dbprintf("security_driver %s\n", dp->auth);
650 cmdline = vstralloc(cmdstr[cmd],
651 " ", disk2serial(dp),
653 " ", dp->host->hostname,
658 " ", sched(dp)->dumpdate,
661 " ", qclient_username,
665 " ", data_path_to_string(dp->data_path),
666 " ", dp->dataport_list,
670 amfree(qamandad_path);
671 amfree(qclient_username);
672 amfree(qclient_port);
679 error(_("PORT-DUMP without disk pointer\n"));
685 qmesg = quote_string(mesg);
686 cmdline = vstralloc(cmdstr[cmd], " ", qmesg, "\n", NULL );
690 error(_("Don't know how to send %s command to dumper"), cmdstr[cmd]);
695 * Note: cmdline already has a '\n'.
698 g_printf(_("driver: send-cmd time %s ignored to down dumper %s: %s"),
699 walltime_str(curclock()), dumper->name, cmdline);
701 g_printf(_("driver: send-cmd time %s to %s: %s"),
702 walltime_str(curclock()), dumper->name, cmdline);
704 if (full_write(dumper->fd, cmdline, strlen(cmdline)) < strlen(cmdline)) {
705 g_printf(_("writing %s command: %s\n"), dumper->name, strerror(errno));
710 if (cmd == QUIT) aclose(dumper->fd);
723 char *cmdline = NULL;
724 char number[NUM_STR_SIZE];
725 char chunksize[NUM_STR_SIZE];
726 char use[NUM_STR_SIZE];
729 assignedhd_t **h=NULL;
736 cmdline = vstralloc(cmdstr[cmd], " ", mesg, "\n", NULL);
739 if(dp && sched(dp) && sched(dp)->holdp) {
740 h = sched(dp)->holdp;
741 activehd = sched(dp)->activehd;
745 qname = quote_string(dp->name);
746 qdest = quote_string(sched(dp)->destname);
747 h[activehd]->disk->allocated_dumpers++;
748 g_snprintf(number, SIZEOF(number), "%d", sched(dp)->level);
749 g_snprintf(chunksize, SIZEOF(chunksize), "%lld",
750 (long long)holdingdisk_get_chunksize(h[0]->disk->hdisk));
751 g_snprintf(use, SIZEOF(use), "%lld",
752 (long long)h[0]->reserved);
753 features = am_feature_to_string(dp->host->features);
755 cmdline = vstralloc(cmdstr[cmd],
756 " ", disk2serial(dp),
758 " ", dp->host->hostname,
762 " ", sched(dp)->dumpdate,
773 error(_("%s command without disk and holding disk.\n"),
779 if(dp && sched(dp) && sched(dp)->holdp) {
780 h = sched(dp)->holdp;
781 activehd = sched(dp)->activehd;
785 qname = quote_string(dp->name);
786 qdest = quote_string(h[activehd]->destname);
787 h[activehd]->disk->allocated_dumpers++;
788 g_snprintf(chunksize, SIZEOF(chunksize), "%lld",
789 (long long)holdingdisk_get_chunksize(h[activehd]->disk->hdisk));
790 g_snprintf(use, SIZEOF(use), "%lld",
791 (long long)(h[activehd]->reserved - h[activehd]->used));
792 cmdline = vstralloc(cmdstr[cmd],
793 " ", disk2serial(dp),
801 cmdline = stralloc2(cmdstr[cmd], "\n");
807 char *q = quote_string(mesg);
808 cmdline = vstralloc(cmdstr[cmd], " ", q, "\n", NULL);
815 cmdline = vstralloc(cmdstr[cmd],
816 " ", disk2serial(dp),
819 cmdline = vstralloc(cmdstr[cmd], "\n", NULL);
823 error(_("Don't know how to send %s command to chunker"), cmdstr[cmd]);
828 * Note: cmdline already has a '\n'.
830 g_printf(_("driver: send-cmd time %s to %s: %s"),
831 walltime_str(curclock()), chunker->name, cmdline);
833 if (full_write(chunker->fd, cmdline, strlen(cmdline)) < strlen(cmdline)) {
834 g_printf(_("writing %s command: %s\n"), chunker->name, strerror(errno));
839 if (cmd == QUIT) aclose(chunker->fd);
844 #define MAX_SERIAL MAX_DUMPERS*2 /* one for each dumper and taper */
851 } stable[MAX_SERIAL];
860 rc = sscanf(str, "%d-%ld", &s, &gen);
862 error(_("error [serial2disk \"%s\" parse error]"), str);
864 } else if (s < 0 || s >= MAX_SERIAL) {
865 error(_("error [serial out of range 0..%d: %d]"), MAX_SERIAL, s);
868 if(gen != stable[s].gen)
869 g_printf(_("driver: serial2disk error time %s serial gen mismatch %s\n"),
870 walltime_str(curclock()), str);
881 rc = sscanf(str, _("%d-%ld"), &s, &gen);
882 if(!(rc == 2 && s >= 0 && s < MAX_SERIAL)) {
883 /* nuke self to get core dump for Brett */
884 g_fprintf(stderr, _("driver: free_serial: str \"%s\" rc %d s %d\n"),
890 if(gen != stable[s].gen)
891 g_printf(_("driver: free_serial error time %s serial gen mismatch %s\n"),
892 walltime_str(curclock()),str);
904 for(s = 0; s < MAX_SERIAL; s++) {
905 if(stable[s].dp == dp) {
912 g_printf(_("driver: error time %s serial not found for disk %s\n"),
913 walltime_str(curclock()), dp->name);
918 check_unfree_serial(void)
922 /* find used serial number */
923 for(s = 0; s < MAX_SERIAL; s++) {
924 if(stable[s].gen != 0 || stable[s].dp != NULL) {
925 g_printf(_("driver: error time %s bug: serial in use: %02d-%05ld\n"),
926 walltime_str(curclock()), s, stable[s].gen);
935 static char str[NUM_STR_SIZE];
937 for(s = 0; s < MAX_SERIAL; s++) {
938 if(stable[s].dp == dp) {
939 g_snprintf(str, SIZEOF(str), "%02d-%05ld", s, stable[s].gen);
944 /* find unused serial number */
945 for(s = 0; s < MAX_SERIAL; s++)
946 if(stable[s].gen == 0 && stable[s].dp == NULL)
948 if(s >= MAX_SERIAL) {
949 g_printf(_("driver: error time %s bug: out of serial numbers\n"),
950 walltime_str(curclock()));
954 stable[s].gen = generation++;
957 g_snprintf(str, SIZEOF(str), "%02d-%05ld", s, stable[s].gen);
974 level = sched(dp)->level;
976 conf_infofile = config_dir_relative(getconf_str(CNF_INFOFILE));
977 if (open_infofile(conf_infofile)) {
978 error(_("could not open info db \"%s\""), conf_infofile);
981 amfree(conf_infofile);
983 get_info(dp->host->hostname, dp->name, &info);
985 /* Clean up information about this and higher-level dumps. This
986 assumes that update_info_dumper() is always run before
987 update_info_taper(). */
988 for (i = level; i < DUMP_LEVELS; ++i) {
990 infp->size = (off_t)-1;
991 infp->csize = (off_t)-1;
992 infp->secs = (time_t)-1;
993 infp->date = (time_t)-1;
994 infp->label[0] = '\0';
998 /* now store information about this dump */
999 infp = &info.inf[level];
1000 infp->size = origsize;
1001 infp->csize = dumpsize;
1002 infp->secs = dumptime;
1003 if (sched(dp)->timestamp == 0) {
1006 infp->date = get_time_from_timestamp(sched(dp)->datestamp);
1009 if(level == 0) perfp = &info.full;
1010 else perfp = &info.incr;
1012 /* Update the stats, but only if the new values are meaningful */
1013 if(dp->compress != COMP_NONE && origsize > (off_t)0) {
1014 newperf(perfp->comp, (double)dumpsize/(double)origsize);
1016 if(dumptime > (time_t)0) {
1017 if((off_t)dumptime >= dumpsize)
1018 newperf(perfp->rate, 1);
1020 newperf(perfp->rate, (double)dumpsize/(double)dumptime);
1023 if(origsize >= (off_t)0 && getconf_int(CNF_RESERVE)<100) {
1024 info.command = NO_COMMAND;
1027 if (origsize >= (off_t)0 && level == info.last_level) {
1028 info.consecutive_runs++;
1029 } else if (origsize >= (off_t)0) {
1030 info.last_level = level;
1031 info.consecutive_runs = 1;
1034 if(origsize >= (off_t)0 && dumpsize >= (off_t)0) {
1035 for(i=NB_HISTORY-1;i>0;i--) {
1036 info.history[i] = info.history[i-1];
1039 info.history[0].level = level;
1040 info.history[0].size = origsize;
1041 info.history[0].csize = dumpsize;
1042 if (sched(dp)->timestamp == 0) {
1043 info.history[0].date = 0;
1045 info.history[0].date = get_time_from_timestamp(sched(dp)->datestamp);
1047 info.history[0].secs = dumptime;
1050 if (put_info(dp->host->hostname, dp->name, &info)) {
1051 int save_errno = errno;
1052 g_fprintf(stderr, _("infofile update failed (%s,'%s'): %s\n"),
1053 dp->host->hostname, dp->name, strerror(save_errno));
1054 log_add(L_ERROR, _("infofile update failed (%s,'%s'): %s\n"),
1055 dp->host->hostname, dp->name, strerror(save_errno));
1056 error(_("infofile update failed (%s,'%s'): %s\n"),
1057 dp->host->hostname, dp->name, strerror(save_errno));
1075 rc = open_infofile(getconf_str(CNF_INFOFILE));
1077 error(_("could not open infofile %s: %s (%d)"), getconf_str(CNF_INFOFILE),
1078 strerror(errno), rc);
1082 get_info(dp->host->hostname, dp->name, &info);
1084 infp = &info.inf[level];
1085 /* XXX - should we record these two if no-record? */
1086 strncpy(infp->label, label, SIZEOF(infp->label)-1);
1087 infp->label[SIZEOF(infp->label)-1] = '\0';
1088 infp->filenum = filenum;
1090 info.command = NO_COMMAND;
1092 if (put_info(dp->host->hostname, dp->name, &info)) {
1093 int save_errno = errno;
1094 g_fprintf(stderr, _("infofile update failed (%s,'%s'): %s\n"),
1095 dp->host->hostname, dp->name, strerror(save_errno));
1096 log_add(L_ERROR, _("infofile update failed (%s,'%s'): %s\n"),
1097 dp->host->hostname, dp->name, strerror(save_errno));
1098 error(_("infofile update failed (%s,'%s'): %s\n"),
1099 dp->host->hostname, dp->name, strerror(save_errno));
1105 /* Free an array of pointers to assignedhd_t after freeing the
1106 * assignedhd_t themselves. The array must be NULL-terminated.
1108 void free_assignedhd(
1113 if( !ahd ) { return; }
1115 for( i = 0; ahd[i]; i++ ) {
1116 amfree(ahd[i]->destname);