Error and warning messages should go to stderr, make it so.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100115141916-tpg2rga1i4pm42kj
This commit is contained in:
Juan RP
2010-01-15 15:19:16 +01:00
parent d2a093a401
commit a165d20193
13 changed files with 151 additions and 102 deletions

View File

@@ -145,8 +145,8 @@ xbps_configure_pkg(const char *pkgname, const char *version, bool check_state,
if ((rv = xbps_file_chdir_exec(rootdir, buf, "post",
pkgname, lver, update ? "yes" : "no", NULL)) != 0) {
free(buf);
printf("%s: post INSTALL action returned: %s\n",
pkgname, strerror(errno));
fprintf(stderr, "%s: post INSTALL action "
"returned: %s\n", pkgname, strerror(errno));
return rv;
}
} else {

View File

@@ -79,13 +79,15 @@ xbps_remove_pkg_files(prop_dictionary_t dict, const char *key)
}
rv = xbps_check_file_hash(path, sha256);
if (rv == ENOENT) {
printf("WARNING: '%s' doesn't exist!\n", file);
fprintf(stderr,
"WARNING: '%s' doesn't exist!\n", file);
free(path);
rv = 0;
continue;
} else if (rv == ERANGE) {
if (flags & XBPS_FLAG_VERBOSE)
printf("WARNING: '%s' SHA256 mismatch, "
fprintf(stderr,
"WARNING: '%s' SHA256 mismatch, "
"preserving...\n", file);
rv = 0;
free(path);
@@ -102,7 +104,8 @@ xbps_remove_pkg_files(prop_dictionary_t dict, const char *key)
continue;
}
if (flags & XBPS_FLAG_VERBOSE) {
printf("WARNING: can't remove "
fprintf(stderr,
"WARNING: can't remove "
"directory %s (%s)\n", file,
strerror(errno));
free(path);
@@ -113,7 +116,8 @@ xbps_remove_pkg_files(prop_dictionary_t dict, const char *key)
if (strcmp(key, "dirs")) {
if ((rv = remove(path)) == -1) {
if (flags & XBPS_FLAG_VERBOSE)
printf("WARNING: can't remove %s "
fprintf(stderr,
"WARNING: can't remove %s "
"(%s)\n", file, strerror(errno));
rv = 0;
@@ -171,7 +175,8 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
rv = xbps_file_chdir_exec(rootdir, buf, "pre", pkgname,
version, update ? "yes" : "no", NULL);
if (rv != 0) {
printf("%s: prerm action target error (%s)\n", pkgname,
fprintf(stderr,
"%s: prerm action target error (%s)\n", pkgname,
strerror(errno));
free(buf);
return rv;
@@ -223,7 +228,8 @@ xbps_remove_pkg(const char *pkgname, const char *version, bool update)
if (update == false && prepostf) {
if ((rv = xbps_file_chdir_exec(rootdir, buf, "post",
pkgname, version, NULL)) != 0) {
printf("%s: postrm action target error (%s)\n",
fprintf(stderr,
"%s: postrm action target error (%s)\n",
pkgname, strerror(errno));
free(buf);
return rv;

View File

@@ -90,7 +90,8 @@ again:
goto out;
}
if (remove(buf) == -1) {
printf("WARNING: couldn't remove obsolete %s: %s\n",
fprintf(stderr,
"WARNING: couldn't remove obsolete %s: %s\n",
dolinks ? "link" : "file",
prop_string_cstring_nocopy(oldstr));
free(buf);

View File

@@ -203,7 +203,8 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
pkgname, version, update ? "yes" : "no",
NULL)) != 0) {
free(buf);
printf("%s: preinst action target error %s\n",
fprintf(stderr,
"%s: preinst action target error %s\n",
pkgname, strerror(errno));
return rv;
}
@@ -271,12 +272,13 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
if (archive_read_extract(ar, entry, lflags) != 0) {
rv = archive_errno(ar);
if (rv != EEXIST) {
printf("ERROR: %s...exiting!\n",
fprintf(stderr, "ERROR: %s...exiting!\n",
archive_error_string(ar));
return rv;;
} else if (rv == EEXIST) {
if (flags & XBPS_FLAG_VERBOSE) {
printf("WARNING: ignoring existent "
fprintf(stderr,
"WARNING: ignoring existent "
"path: %s\n",
archive_entry_pathname(entry));
}