1 /* opkg_conf.c - the opkg package management system
5 Copyright (C) 2001 University of Southern California
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2, or (at
10 your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
19 #include "opkg_conf.h"
20 #include "opkg_error.h"
23 #include "sprintf_alloc.h"
24 #include "opkg_conf.h"
25 #include "opkg_message.h"
26 #include "file_util.h"
30 #include "opkg_defines.h"
32 #include <sys/types.h>
36 static int opkg_conf_parse_file(opkg_conf_t
*conf
, const char *filename
,
37 pkg_src_list_t
*pkg_src_list
,
38 nv_pair_list_t
*tmp_dest_nv_pair_list
,
39 char **tmp_lists_dir
);
40 static int opkg_conf_set_option(const opkg_option_t
*options
,
41 const char *name
, const char *value
);
42 static int opkg_conf_set_default_dest(opkg_conf_t
*conf
,
43 const char *default_dest_name
);
44 static int set_and_load_pkg_src_list(opkg_conf_t
*conf
,
45 pkg_src_list_t
*nv_pair_list
);
46 static int set_and_load_pkg_dest_list(opkg_conf_t
*conf
,
47 nv_pair_list_t
*nv_pair_list
, char * lists_dir
);
49 int opkg_init_options_array(const opkg_conf_t
*conf
, opkg_option_t
**options
)
51 opkg_option_t tmp
[] = {
52 { "cache", OPKG_OPT_TYPE_STRING
, &conf
->cache
},
53 { "force_defaults", OPKG_OPT_TYPE_BOOL
, &conf
->force_defaults
},
54 { "force_maintainer", OPKG_OPT_TYPE_BOOL
, &conf
->force_maintainer
},
55 { "force_depends", OPKG_OPT_TYPE_BOOL
, &conf
->force_depends
},
56 { "force_overwrite", OPKG_OPT_TYPE_BOOL
, &conf
->force_overwrite
},
57 { "force_downgrade", OPKG_OPT_TYPE_BOOL
, &conf
->force_downgrade
},
58 { "force_reinstall", OPKG_OPT_TYPE_BOOL
, &conf
->force_reinstall
},
59 { "force_space", OPKG_OPT_TYPE_BOOL
, &conf
->force_space
},
60 { "check_signature", OPKG_OPT_TYPE_INT
, &conf
->check_signature
},
61 { "ftp_proxy", OPKG_OPT_TYPE_STRING
, &conf
->ftp_proxy
},
62 { "http_proxy", OPKG_OPT_TYPE_STRING
, &conf
->http_proxy
},
63 { "no_proxy", OPKG_OPT_TYPE_STRING
, &conf
->no_proxy
},
64 { "test", OPKG_OPT_TYPE_INT
, &conf
->noaction
},
65 { "noaction", OPKG_OPT_TYPE_INT
, &conf
->noaction
},
66 { "nodeps", OPKG_OPT_TYPE_BOOL
, &conf
->nodeps
},
67 { "offline_root", OPKG_OPT_TYPE_STRING
, &conf
->offline_root
},
68 { "offline_root_path", OPKG_OPT_TYPE_STRING
, &conf
->offline_root_path
},
69 { "offline_root_post_script_cmd", OPKG_OPT_TYPE_STRING
, &conf
->offline_root_post_script_cmd
},
70 { "offline_root_pre_script_cmd", OPKG_OPT_TYPE_STRING
, &conf
->offline_root_pre_script_cmd
},
71 { "proxy_passwd", OPKG_OPT_TYPE_STRING
, &conf
->proxy_passwd
},
72 { "proxy_user", OPKG_OPT_TYPE_STRING
, &conf
->proxy_user
},
73 { "query-all", OPKG_OPT_TYPE_BOOL
, &conf
->query_all
},
74 { "verbosity", OPKG_OPT_TYPE_BOOL
, &conf
->verbosity
},
78 *options
= (opkg_option_t
*)calloc(1, sizeof(tmp
));
79 if ( options
== NULL
){
80 fprintf(stderr
,"%s: Unable to allocate memory\n",__FUNCTION__
);
84 memcpy(*options
, tmp
, sizeof(tmp
));
88 static void opkg_conf_override_string(char **conf_str
, char *arg_str
)
94 *conf_str
= strdup(arg_str
);
98 static void opkg_conf_free_string(char **conf_str
)
106 int opkg_conf_init(opkg_conf_t
*conf
, const args_t
*args
)
110 nv_pair_list_t tmp_dest_nv_pair_list
;
111 char *lists_dir
= NULL
, *lock_file
= NULL
;
113 char *etc_opkg_conf_pattern
= "/etc/opkg/*.conf";
114 char *pending_dir
= NULL
;
116 memset(conf
, 0, sizeof(opkg_conf_t
));
118 pkg_src_list_init(&conf
->pkg_src_list
);
120 nv_pair_list_init(&tmp_dest_nv_pair_list
);
121 pkg_dest_list_init(&conf
->pkg_dest_list
);
123 nv_pair_list_init(&conf
->arch_list
);
125 conf
->restrict_to_default_dest
= 0;
126 conf
->default_dest
= NULL
;
128 /* check for lock file */
129 if (args
->offline_root
)
130 sprintf_alloc (&lock_file
, "%s/%s/lock", args
->offline_root
, OPKG_STATE_DIR_PREFIX
);
132 sprintf_alloc (&lock_file
, "%s/lock", OPKG_STATE_DIR_PREFIX
);
134 conf
->lock_fd
= creat (lock_file
, S_IRUSR
| S_IWUSR
| S_IRGRP
);
135 err
= lockf (conf
->lock_fd
, F_TLOCK
, 0);
141 opkg_message (conf
, OPKG_ERROR
, "Could not obtain administrative lock\n");
142 return OPKG_CONF_ERR_LOCK
;
146 tmp_dir_base
= args
->tmp_dir
;
148 tmp_dir_base
= getenv("TMPDIR");
149 sprintf_alloc(&conf
->tmp_dir
, "%s/%s",
150 tmp_dir_base
? tmp_dir_base
: OPKG_CONF_DEFAULT_TMP_DIR_BASE
,
151 OPKG_CONF_TMP_DIR_SUFFIX
);
152 conf
->tmp_dir
= mkdtemp(conf
->tmp_dir
);
153 if (conf
->tmp_dir
== NULL
) {
154 fprintf(stderr
, "%s: Failed to create temporary directory `%s': %s\n",
155 __FUNCTION__
, conf
->tmp_dir
, strerror(errno
));
156 return OPKG_CONF_ERR_TMP_DIR
;
159 pkg_hash_init("pkg-hash", &conf
->pkg_hash
, OPKG_CONF_DEFAULT_HASH_LEN
);
160 hash_table_init("file-hash", &conf
->file_hash
, OPKG_CONF_DEFAULT_HASH_LEN
);
161 hash_table_init("obs-file-hash", &conf
->obs_file_hash
, OPKG_CONF_DEFAULT_HASH_LEN
);
162 lists_dir
=(char *)malloc(1);
164 if (args
->conf_file
) {
165 struct stat stat_buf
;
166 err
= stat(args
->conf_file
, &stat_buf
);
168 if (opkg_conf_parse_file(conf
, args
->conf_file
,
169 &conf
->pkg_src_list
, &tmp_dest_nv_pair_list
,&lists_dir
)<0) {
170 /* Memory leakage from opkg_conf_parse-file */
171 return OPKG_CONF_ERR_PARSE
;
175 if (strlen(lists_dir
)<=1 ){
176 lists_dir
= realloc(lists_dir
,strlen(OPKG_CONF_LISTS_DIR
)+2);
177 sprintf (lists_dir
,"%s",OPKG_CONF_LISTS_DIR
);
180 if (args
->offline_root
) {
182 sprintf_alloc(&tmp
, "%s/%s",args
->offline_root
,lists_dir
);
187 pending_dir
= calloc(1, strlen(lists_dir
)+strlen("/pending")+5);
188 snprintf(pending_dir
,strlen(lists_dir
)+strlen("/pending") ,"%s%s",lists_dir
,"/pending");
190 conf
->lists_dir
= strdup(lists_dir
);
191 conf
->pending_dir
= strdup(pending_dir
);
193 if (args
->offline_root
)
194 sprintf_alloc(&etc_opkg_conf_pattern
, "%s/etc/opkg/*.conf", args
->offline_root
);
195 memset(&globbuf
, 0, sizeof(globbuf
));
196 err
= glob(etc_opkg_conf_pattern
, 0, NULL
, &globbuf
);
197 if (args
->offline_root
)
198 free (etc_opkg_conf_pattern
);
201 for (i
= 0; i
< globbuf
.gl_pathc
; i
++) {
202 if (globbuf
.gl_pathv
[i
])
203 if ( opkg_conf_parse_file(conf
, globbuf
.gl_pathv
[i
],
204 &conf
->pkg_src_list
, &tmp_dest_nv_pair_list
,&lists_dir
)<0) {
205 /* Memory leakage from opkg_conf_parse-file */
206 return OPKG_CONF_ERR_PARSE
;
212 /* if no architectures were defined, then default all, noarch, and host architecture */
213 if (nv_pair_list_empty(&conf
->arch_list
)) {
214 nv_pair_list_append(&conf
->arch_list
, "all", "1");
215 nv_pair_list_append(&conf
->arch_list
, "noarch", "1");
216 nv_pair_list_append(&conf
->arch_list
, HOST_CPU_STR
, "10");
219 /* Even if there is no conf file, we'll need at least one dest. */
220 if (nv_pair_list_empty(&tmp_dest_nv_pair_list
)) {
221 nv_pair_list_append(&tmp_dest_nv_pair_list
,
222 OPKG_CONF_DEFAULT_DEST_NAME
,
223 OPKG_CONF_DEFAULT_DEST_ROOT_DIR
);
226 /* After parsing the file, set options from command-line, (so that
227 command-line arguments take precedence) */
228 /* XXX: CLEANUP: The interaction between args.c and opkg_conf.c
229 really needs to be cleaned up. There is so much duplication
230 right now it is ridiculous. Maybe opkg_conf_t should just save
231 a pointer to args_t (which could then not be freed), rather
232 than duplicating every field here? */
233 if (args
->autoremove
) {
234 conf
->autoremove
= 1;
236 if (args
->force_depends
) {
237 conf
->force_depends
= 1;
239 if (args
->force_defaults
) {
240 conf
->force_defaults
= 1;
242 if (args
->force_maintainer
) {
243 conf
->force_maintainer
= 1;
245 if (args
->force_overwrite
) {
246 conf
->force_overwrite
= 1;
248 if (args
->force_downgrade
) {
249 conf
->force_downgrade
= 1;
251 if (args
->force_reinstall
) {
252 conf
->force_reinstall
= 1;
254 if (args
->force_removal_of_dependent_packages
) {
255 conf
->force_removal_of_dependent_packages
= 1;
257 if (args
->force_removal_of_essential_packages
) {
258 conf
->force_removal_of_essential_packages
= 1;
263 if (args
->noaction
) {
266 if (args
->query_all
) {
269 if (args
->verbosity
!= conf
->verbosity
) {
270 conf
->verbosity
= args
->verbosity
;
273 opkg_conf_override_string(&conf
->offline_root
,
275 opkg_conf_override_string(&conf
->offline_root_path
,
276 args
->offline_root_path
);
277 opkg_conf_override_string(&conf
->offline_root_pre_script_cmd
,
278 args
->offline_root_pre_script_cmd
);
279 opkg_conf_override_string(&conf
->offline_root_post_script_cmd
,
280 args
->offline_root_post_script_cmd
);
282 opkg_conf_override_string(&conf
->cache
, args
->cache
);
284 /* Pigi: added a flag to disable the checking of structures if the command does not need to
285 read anything from there.
287 if ( !(args
->nocheckfordirorfile
)){
288 /* need to run load the source list before dest list -Jamey */
289 if ( !(args
->noreadfeedsfile
))
290 set_and_load_pkg_src_list(conf
, &conf
->pkg_src_list
);
292 /* Now that we have resolved conf->offline_root, we can commit to
293 the directory names for the dests and load in all the package
295 set_and_load_pkg_dest_list(conf
, &tmp_dest_nv_pair_list
,lists_dir
);
298 err
= opkg_conf_set_default_dest(conf
, args
->dest
);
300 return OPKG_CONF_ERR_DEFAULT_DEST
;
304 nv_pair_list_deinit(&tmp_dest_nv_pair_list
);
311 void opkg_conf_deinit(opkg_conf_t
*conf
)
313 #ifdef OPKG_DEBUG_NO_TMP_CLEANUP
315 fprintf(stderr
, "%s: Not cleaning up %s since opkg compiled "
316 "with OPKG_DEBUG_NO_TMP_CLEANUP\n",
317 __FUNCTION__
, conf
->tmp_dir
);
321 err
= rmdir(conf
->tmp_dir
);
323 if (errno
== ENOTEMPTY
) {
325 sprintf_alloc(&cmd
, "rm -fr %s\n", conf
->tmp_dir
);
330 fprintf(stderr
, "WARNING: Unable to remove temporary directory: %s: %s\n", conf
->tmp_dir
, strerror(errno
));
332 #endif /* OPKG_DEBUG_NO_TMP_CLEANUP */
334 free(conf
->tmp_dir
); /*XXX*/
335 free(conf
->lists_dir
);
336 free(conf
->pending_dir
);
338 pkg_src_list_deinit(&conf
->pkg_src_list
);
339 pkg_dest_list_deinit(&conf
->pkg_dest_list
);
340 nv_pair_list_deinit(&conf
->arch_list
);
342 pkg_hash_deinit(&conf
->pkg_hash
);
343 if (&conf
->file_hash
)
344 hash_table_deinit(&conf
->file_hash
);
345 if (&conf
->obs_file_hash
)
346 hash_table_deinit(&conf
->obs_file_hash
);
348 opkg_conf_free_string(&conf
->offline_root
);
349 opkg_conf_free_string(&conf
->offline_root_path
);
350 opkg_conf_free_string(&conf
->offline_root_pre_script_cmd
);
351 opkg_conf_free_string(&conf
->offline_root_post_script_cmd
);
353 opkg_conf_free_string(&conf
->cache
);
355 if (conf
->verbosity
> 1) {
357 hash_table_t
*hashes
[] = {
360 &conf
->obs_file_hash
};
361 for (i
= 0; i
< 3; i
++) {
362 hash_table_t
*hash
= hashes
[i
];
366 for (j
= 0; j
< hash
->n_entries
; j
++) {
368 hash_entry_t
*e
= &hash
->entries
[j
];
371 while (e
&& e
->key
) {
378 opkg_message(conf
, OPKG_DEBUG
, "hash_table[%s] n_buckets=%d n_elements=%d max_conflicts=%d n_conflicts=%d\n",
379 hash
->name
, hash
->n_entries
, hash
->n_elements
, c
, n_conflicts
);
380 hash_table_deinit(hash
);
385 static int opkg_conf_set_default_dest(opkg_conf_t
*conf
,
386 const char *default_dest_name
)
388 pkg_dest_list_elt_t
*iter
;
391 for (iter
= void_list_first(&conf
->pkg_dest_list
); iter
; iter
= void_list_next(&conf
->pkg_dest_list
, iter
)) {
392 dest
= (pkg_dest_t
*)iter
->data
;
393 if (strcmp(dest
->name
, default_dest_name
) == 0) {
394 conf
->default_dest
= dest
;
395 conf
->restrict_to_default_dest
= 1;
400 fprintf(stderr
, "ERROR: Unknown dest name: `%s'\n", default_dest_name
);
405 static int set_and_load_pkg_src_list(opkg_conf_t
*conf
, pkg_src_list_t
*pkg_src_list
)
407 pkg_src_list_elt_t
*iter
;
411 for (iter
= void_list_first(pkg_src_list
); iter
; iter
= void_list_next(pkg_src_list
, iter
)) {
412 src
= (pkg_src_t
*)iter
->data
;
417 sprintf_alloc(&list_file
, "%s/%s",
418 conf
->restrict_to_default_dest
? conf
->default_dest
->lists_dir
: conf
->lists_dir
,
421 if (file_exists(list_file
)) {
422 pkg_hash_add_from_file(conf
, list_file
, src
, NULL
, 0);
430 static int set_and_load_pkg_dest_list(opkg_conf_t
*conf
, nv_pair_list_t
*nv_pair_list
, char *lists_dir
)
432 nv_pair_list_elt_t
*iter
;
437 for (iter
= nv_pair_list_first(nv_pair_list
); iter
; iter
= nv_pair_list_next(nv_pair_list
, iter
)) {
438 nv_pair
= (nv_pair_t
*)iter
->data
;
440 if (conf
->offline_root
) {
441 sprintf_alloc(&root_dir
, "%s%s", conf
->offline_root
, nv_pair
->value
);
443 root_dir
= strdup(nv_pair
->value
);
445 dest
= pkg_dest_list_append(&conf
->pkg_dest_list
, nv_pair
->name
, root_dir
, lists_dir
);
450 if (conf
->default_dest
== NULL
) {
451 conf
->default_dest
= dest
;
453 if (file_exists(dest
->status_file_name
)) {
454 pkg_hash_add_from_file(conf
, dest
->status_file_name
,
462 static int opkg_conf_parse_file(opkg_conf_t
*conf
, const char *filename
,
463 pkg_src_list_t
*pkg_src_list
,
464 nv_pair_list_t
*tmp_dest_nv_pair_list
,
468 opkg_option_t
* options
;
469 FILE *file
= fopen(filename
, "r");
470 regex_t valid_line_re
, comment_re
;
471 #define regmatch_size 12
472 regmatch_t regmatch
[regmatch_size
];
474 if (opkg_init_options_array(conf
, &options
)<0)
478 fprintf(stderr
, "%s: failed to open %s: %s\n",
479 __FUNCTION__
, filename
, strerror(errno
));
483 opkg_message(conf
, OPKG_NOTICE
, "loading conf file %s\n", filename
);
485 err
= xregcomp(&comment_re
,
486 "^[[:space:]]*(#.*|[[:space:]]*)$",
492 err
= xregcomp(&valid_line_re
, "^[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))[[:space:]]*(\"([^\"]*)\"|([^[:space:]]*))([[:space:]]+([^[:space:]]+))?[[:space:]]*$", REG_EXTENDED
);
501 char *type
, *name
, *value
, *extra
;
503 line
= file_read_line_alloc(file
);
511 if (regexec(&comment_re
, line
, 0, 0, 0) == 0) {
515 if (regexec(&valid_line_re
, line
, regmatch_size
, regmatch
, 0) == REG_NOMATCH
) {
517 fprintf(stderr
, "%s:%d: Ignoring invalid line: `%s'\n",
518 filename
, line_num
, line
);
522 /* This has to be so ugly to deal with optional quotation marks */
523 if (regmatch
[2].rm_so
> 0) {
524 type
= strndup(line
+ regmatch
[2].rm_so
,
525 regmatch
[2].rm_eo
- regmatch
[2].rm_so
);
527 type
= strndup(line
+ regmatch
[3].rm_so
,
528 regmatch
[3].rm_eo
- regmatch
[3].rm_so
);
530 if (regmatch
[5].rm_so
> 0) {
531 name
= strndup(line
+ regmatch
[5].rm_so
,
532 regmatch
[5].rm_eo
- regmatch
[5].rm_so
);
534 name
= strndup(line
+ regmatch
[6].rm_so
,
535 regmatch
[6].rm_eo
- regmatch
[6].rm_so
);
537 if (regmatch
[8].rm_so
> 0) {
538 value
= strndup(line
+ regmatch
[8].rm_so
,
539 regmatch
[8].rm_eo
- regmatch
[8].rm_so
);
541 value
= strndup(line
+ regmatch
[9].rm_so
,
542 regmatch
[9].rm_eo
- regmatch
[9].rm_so
);
545 if (regmatch
[11].rm_so
> 0) {
546 extra
= strndup (line
+ regmatch
[11].rm_so
,
547 regmatch
[11].rm_eo
- regmatch
[11].rm_so
);
550 /* We use the tmp_dest_nv_pair_list below instead of
551 conf->pkg_dest_list because we might encounter an
552 offline_root option later and that would invalidate the
553 directories we would have computed in
554 pkg_dest_list_init. (We do a similar thing with
555 tmp_src_nv_pair_list for sake of symmetry.) */
556 if (strcmp(type
, "option") == 0) {
557 opkg_conf_set_option(options
, name
, value
);
558 } else if (strcmp(type
, "src") == 0) {
559 if (!nv_pair_list_find((nv_pair_list_t
*) pkg_src_list
, name
)) {
560 pkg_src_list_append (pkg_src_list
, name
, value
, extra
, 0);
562 opkg_message(conf
, OPKG_ERROR
, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n",
565 } else if (strcmp(type
, "src/gz") == 0) {
566 if (!nv_pair_list_find((nv_pair_list_t
*) pkg_src_list
, name
)) {
567 pkg_src_list_append (pkg_src_list
, name
, value
, extra
, 1);
569 opkg_message(conf
, OPKG_ERROR
, "ERROR: duplicate src declaration. Skipping:\n\t src %s %s\n",
572 } else if (strcmp(type
, "dest") == 0) {
573 nv_pair_list_append(tmp_dest_nv_pair_list
, name
, value
);
574 } else if (strcmp(type
, "lists_dir") == 0) {
575 *lists_dir
= realloc(*lists_dir
,strlen(value
)+1);
576 if (*lists_dir
== NULL
) {
577 opkg_message(conf
, OPKG_ERROR
, "ERROR: Not enough memory\n");
581 sprintf (*lists_dir
,"%s",value
);
582 } else if (strcmp(type
, "arch") == 0) {
583 opkg_message(conf
, OPKG_INFO
, "supported arch %s priority (%s)\n", name
, value
);
585 opkg_message(conf
, OPKG_NOTICE
, "defaulting architecture %s priority to 10\n", name
);
586 value
= strdup("10");
588 nv_pair_list_append(&conf
->arch_list
, name
, value
);
590 fprintf(stderr
, "WARNING: Ignoring unknown configuration "
591 "parameter: %s %s %s\n", type
, name
, value
);
607 regfree(&comment_re
);
608 regfree(&valid_line_re
);
614 static int opkg_conf_set_option(const opkg_option_t
*options
,
615 const char *name
, const char *value
)
618 while (options
[i
].name
) {
619 if (strcmp(options
[i
].name
, name
) == 0) {
620 switch (options
[i
].type
) {
621 case OPKG_OPT_TYPE_BOOL
:
622 *((int *)options
[i
].value
) = 1;
624 case OPKG_OPT_TYPE_INT
:
626 *((int *)options
[i
].value
) = atoi(value
);
629 printf("%s: Option %s need an argument\n",
633 case OPKG_OPT_TYPE_STRING
:
635 *((char **)options
[i
].value
) = strdup(value
);
638 printf("%s: Option %s need an argument\n",
647 fprintf(stderr
, "%s: Unrecognized option: %s=%s\n",
648 __FUNCTION__
, name
, value
);
652 int opkg_conf_write_status_files(opkg_conf_t
*conf
)
659 FILE * status_file
=NULL
;
664 dest
= (pkg_dest_t
*)void_list_first(&conf
->pkg_dest_list
)->data
;
665 status_file
= fopen(dest
->status_file_tmp_name
, "w");
666 if (status_file
== NULL
) {
667 fprintf(stderr
, "%s: Can't open status file: %s for writing: %s\n",
668 __FUNCTION__
, dest
->status_file_tmp_name
, strerror(errno
));
671 all
= pkg_vec_alloc();
672 pkg_hash_fetch_available(&conf
->pkg_hash
, all
);
674 for(i
= 0; i
< all
->len
; i
++) {
676 /* We don't need most uninstalled packages in the status file */
677 if (pkg
->state_status
== SS_NOT_INSTALLED
678 && (pkg
->state_want
== SW_UNKNOWN
679 || pkg
->state_want
== SW_DEINSTALL
680 || pkg
->state_want
== SW_PURGE
)) {
684 fprintf(stderr
, "Null package\n");
686 if (pkg
->dest
== NULL
) {
687 fprintf(stderr
, "%s: ERROR: Can't write status for "
688 "package %s since it has a NULL dest\n",
689 __FUNCTION__
, pkg
->name
);
693 pkg_print_status(pkg
, status_file
);
700 err
= ferror(status_file
);
703 file_move(dest
->status_file_tmp_name
, dest
->status_file_name
);
705 fprintf(stderr
, "%s: ERROR: An error has occurred writing %s, "
706 "retaining old %s\n", __FUNCTION__
,
707 dest
->status_file_tmp_name
, dest
->status_file_name
);
715 char *root_filename_alloc(opkg_conf_t
*conf
, char *filename
)
718 sprintf_alloc(&root_filename
, "%s%s", (conf
->offline_root
? conf
->offline_root
: ""), filename
);
719 return root_filename
;