f = fopen(filename, "rb");
if (!f) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Cannot open a file: %s", strerror(errno));
+ "Cannot open a file: %s", g_strerror(errno));
return NULL;
}
EVP_DigestUpdate(ctx, buf, readed);
} else {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Error while reading a file: %s", strerror(errno));
+ "Error while reading a file: %s", g_strerror(errno));
EVP_MD_CTX_destroy(ctx);
fclose(f);
return NULL;
int errnum;
char *msg = (char *) gzerror(f, &errnum);
if (errnum == Z_ERRNO)
- msg = strerror(errno);
+ msg = g_strerror(errno);
return msg;
}
file->FILE = (void *) fopen(filename, mode_str);
if (!file->FILE)
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "fopen(): %s", strerror(errno));
+ "fopen(): %s", g_strerror(errno));
break;
case (CR_CW_GZ_COMPRESSION): // ---------------------------------------
file->FILE = (void *) gzopen(filename, mode_str);
if (!file->FILE) {
g_set_error(err, ERR_DOMAIN, CRE_GZ,
- "gzopen(): %s", strerror(errno));
+ "gzopen(): %s", g_strerror(errno));
break;
}
if (!f) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "fopen(): %s", strerror(errno));
+ "fopen(): %s", g_strerror(errno));
break;
}
FILE *f = fopen(filename, mode_str);
if (!f) {
g_set_error(err, ERR_DOMAIN, CRE_XZ,
- "fopen(): %s", strerror(errno));
+ "fopen(): %s", g_strerror(errno));
lzma_end(&(xz_file->stream));
g_free((void *) xz_file);
break;
} else {
ret = CRE_IO;
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "fclose(): %s", strerror(errno));
+ "fclose(): %s", g_strerror(errno));
}
break;
// Error while writing
ret = CRE_XZ;
g_set_error(err, ERR_DOMAIN, CRE_XZ,
- "XZ: fwrite() error: %s", strerror(errno));
+ "XZ: fwrite() error: %s", g_strerror(errno));
break;
}
if ((ret != (int) len) && !feof((FILE *) cr_file->FILE)) {
ret = CR_CW_ERR;
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "fread(): %s", strerror(errno));
+ "fread(): %s", g_strerror(errno));
}
break;
if ((lret = fread(xz_file->buffer, 1, XZ_BUFFER_SIZE, xz_file->file)) < 0) {
g_debug("%s: XZ: Error while fread", __func__);
g_set_error(err, ERR_DOMAIN, CRE_XZ,
- "XZ: fread(): %s", strerror(errno));
+ "XZ: fread(): %s", g_strerror(errno));
return CR_CW_ERR; // Error while reading input file
} else if (lret == 0) {
g_debug("%s: EOF", __func__);
if ((ret = (int) fwrite(buffer, 1, len, (FILE *) cr_file->FILE)) != (int) len) {
ret = CR_CW_ERR;
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "fwrite(): %s", strerror(errno));
+ "fwrite(): %s", g_strerror(errno));
}
break;
if ((fwrite(xz_file->buffer, 1, out_len, xz_file->file)) != out_len) {
ret = CR_CW_ERR;
g_set_error(err, ERR_DOMAIN, CRE_XZ,
- "XZ: fwrite(): %s", strerror(errno));
+ "XZ: fwrite(): %s", g_strerror(errno));
break; // Error while writing
}
}
} else {
g_set_error(err, CREATEREPO_C_ERROR, CRE_BADARG,
"cannot use cachedir %s: %s",
- cmd_options->checksum_cachedir, strerror(errno));
+ cmd_options->checksum_cachedir, g_strerror(errno));
return FALSE;
}
}
output_pkg_list = fopen(cmd_options->read_pkgs_list, "w");
if (!output_pkg_list) {
g_critical("Cannot open \"%s\" for writing: %s",
- cmd_options->read_pkgs_list, strerror(errno));
+ cmd_options->read_pkgs_list, g_strerror(errno));
exit(EXIT_FAILURE);
}
}
pri_db_fd = g_mkstemp(pri_db_filename);
g_debug("%s", pri_db_filename);
if (pri_db_fd == -1) {
- g_critical("Cannot open %s: %s", pri_db_filename, strerror(errno));
+ g_critical("Cannot open %s: %s", pri_db_filename, g_strerror(errno));
exit(EXIT_FAILURE);
}
fil_db_fd = g_mkstemp(fil_db_filename);
g_debug("%s", fil_db_filename);
if (fil_db_fd == -1) {
- g_critical("Cannot open %s: %s", fil_db_filename, strerror(errno));
+ g_critical("Cannot open %s: %s", fil_db_filename, g_strerror(errno));
exit(EXIT_FAILURE);
}
oth_db_fd = g_mkstemp(oth_db_filename);
g_debug("%s", oth_db_filename);
if (oth_db_fd == -1) {
- g_critical("Cannot open %s: %s", oth_db_filename, strerror(errno));
+ g_critical("Cannot open %s: %s", oth_db_filename, g_strerror(errno));
exit(EXIT_FAILURE);
}
}
goto deltaerror;
}
} else if (g_mkdir(outdeltadir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH)) {
- g_critical("Cannot create %s: %s", outdeltadir, strerror(errno));
+ g_critical("Cannot create %s: %s", outdeltadir, g_strerror(errno));
goto deltaerror;
}
gchar *repomd_path = g_strconcat(tmp_out_repo, "repomd.xml", NULL);
FILE *frepomd = fopen(repomd_path, "w");
if (!frepomd) {
- g_critical("Cannot open %s: %s", repomd_path, strerror(errno));
+ g_critical("Cannot open %s: %s", repomd_path, g_strerror(errno));
exit(EXIT_FAILURE);
}
fputs(repomd_xml, frepomd);
if (g_rename(out_repo, old_repodata_path) == -1) {
g_debug("Old repodata doesn't exists: Cannot rename %s -> %s: %s",
- out_repo, old_repodata_path, strerror(errno));
+ out_repo, old_repodata_path, g_strerror(errno));
} else {
g_debug("Renamed %s -> %s", out_repo, old_repodata_path);
old_repodata_renamed = TRUE;
// Rename tmp_out_repo to out_repo
if (g_rename(tmp_out_repo, out_repo) == -1) {
g_critical("Cannot rename %s -> %s: %s", tmp_out_repo, out_repo,
- strerror(errno));
+ g_strerror(errno));
exit(EXIT_FAILURE);
} else {
g_debug("Renamed %s -> %s", tmp_out_repo, out_repo);
if (sigprocmask(SIG_BLOCK, &intmask, NULL)) {
g_set_error(err, CREATEREPO_C_ERROR, CRE_SIGPROCMASK,
- "Cannot block terminating signals: %s", strerror(errno));
+ "Cannot block terminating signals: %s", g_strerror(errno));
return FALSE;
}
if (sigprocmask(SIG_UNBLOCK, &intmask, NULL)) {
g_set_error(err, CREATEREPO_C_ERROR, CRE_SIGPROCMASK,
- "Cannot unblock terminating signals: %s", strerror(errno));
+ "Cannot unblock terminating signals: %s", g_strerror(errno));
return FALSE;
}
if (errno != EEXIST) {
g_set_error(err, CREATEREPO_C_ERROR, CRE_IO,
"Error while creating temporary repodata "
- "directory: %s: %s", lock_dir, strerror(errno));
+ "directory: %s: %s", lock_dir, g_strerror(errno));
return FALSE;
}
// Try to create own - just as a lock
if (g_mkdir(lock_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) {
g_critical("(--ignore-lock enabled) Cannot create %s: %s",
- lock_dir, strerror(errno));
+ lock_dir, g_strerror(errno));
g_set_error(err, CREATEREPO_C_ERROR, CRE_IO,
"Cannot create: %s (--ignore-lock enabled): %s",
- lock_dir, strerror(errno));
+ lock_dir, g_strerror(errno));
return FALSE;
} else {
g_debug("(--ignore-lock enabled) Own and empty %s created "
if (g_mkdir(tmp_repodata_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) {
g_critical("(--ignore-lock enabled) Cannot create %s: %s",
- tmp_repodata_dir, strerror(errno));
+ tmp_repodata_dir, g_strerror(errno));
g_set_error(err, CREATEREPO_C_ERROR, CRE_IO,
"Cannot create: %s (--ignore-lock enabled): %s",
- tmp_repodata_dir, strerror(errno));
+ tmp_repodata_dir, g_strerror(errno));
return FALSE;
} else {
g_debug("(--ignore-lock enabled) For data generation is used: %s",
full_path = g_build_filename(dirname, filename, NULL);
if (stat(full_path, &st) == -1) {
- g_warning("Cannot stat %s: %s", full_path, strerror(errno));
+ g_warning("Cannot stat %s: %s", full_path, g_strerror(errno));
g_free(full_path);
continue;
}
}
if (stat(full_path, &st) == -1) {
- g_warning("Cannot stat %s: %s", full_path, strerror(errno));
+ g_warning("Cannot stat %s: %s", full_path, g_strerror(errno));
g_free(full_path);
continue;
}
// Stat the package (to get the size)
if (stat(task->full_path, &st) == -1) {
g_warning("%s: stat(%s) error (%s)", __func__,
- task->full_path, strerror(errno));
+ task->full_path, g_strerror(errno));
goto exit;
} else {
dpkg->package->size_package = st.st_size;
struct stat stat_buf_own;
if (stat(filename, &stat_buf_own) == -1) {
g_warning("%s: stat(%s) error (%s)", __func__,
- filename, strerror(errno));
+ filename, g_strerror(errno));
g_set_error(err, CREATEREPO_C_ERROR, CRE_IO, "stat(%s) failed: %s",
- filename, strerror(errno));
+ filename, g_strerror(errno));
goto errexit;
}
pkg->time_file = stat_buf_own.st_mtime;
// Get stat info about file
if (udata->old_metadata && !(udata->skip_stat)) {
if (stat(task->full_path, &stat_buf) == -1) {
- g_critical("Stat() on %s: %s", task->full_path, strerror(errno));
+ g_critical("Stat() on %s: %s", task->full_path, g_strerror(errno));
goto task_cleanup;
}
}
if (g_remove(full_path) != -1)
g_debug("Removed %s", full_path);
else
- g_warning("Cannot remove %s: %s", full_path, strerror(errno));
+ g_warning("Cannot remove %s: %s", full_path, g_strerror(errno));
g_free(full_path);
}
tmp_dir = g_build_filename(g_get_tmp_dir(), TMPDIR_PATTERN, NULL);
if(!mkdtemp(tmp_dir)) {
g_critical("%s: Cannot create a temporary directory: %s",
- __func__, strerror(errno));
+ __func__, g_strerror(errno));
return ret;
}
if (g_mkdir_with_parents (cmd_options->tmp_out_repo, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) {
g_critical("Error while creating temporary repodata directory %s: %s",
- cmd_options->tmp_out_repo, strerror(errno));
+ cmd_options->tmp_out_repo, g_strerror(errno));
free_options(cmd_options);
return 1;
FILE *fp = fopen(filename, "rb");
if (!fp) {
g_debug("%s: Cannot open file %s (%s)", __func__, filename,
- strerror(errno));
+ g_strerror(errno));
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Cannot open %s: %s", filename, strerror(errno));
+ "Cannot open %s: %s", filename, g_strerror(errno));
return results;
}
if (fseek(fp, 104, SEEK_SET) != 0) {
g_debug("%s: fseek fail on %s (%s)", __func__, filename,
- strerror(errno));
+ g_strerror(errno));
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Cannot seek over %s: %s", filename, strerror(errno));
+ "Cannot seek over %s: %s", filename, g_strerror(errno));
fclose(fp);
return results;
}
unsigned int sigdata = 0;
if (fread(&sigindex, VAL_LEN, 1, fp) != 1) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "fread() error on %s: %s", filename, strerror(errno));
+ "fread() error on %s: %s", filename, g_strerror(errno));
fclose(fp);
return results;
}
sigindex = htonl(sigindex);
if (fread(&sigdata, VAL_LEN, 1, fp) != 1) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "fread() error on %s: %s", filename, strerror(errno));
+ "fread() error on %s: %s", filename, g_strerror(errno));
fclose(fp);
return results;
}
unsigned int hdrdata = 0;
if (fread(&hdrindex, VAL_LEN, 1, fp) != 1) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "fread() error on %s: %s", filename, strerror(errno));
+ "fread() error on %s: %s", filename, g_strerror(errno));
fclose(fp);
return results;
}
hdrindex = htonl(hdrindex);
if (fread(&hdrdata, VAL_LEN, 1, fp) != 1) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "fread() error on %s: %s", filename, strerror(errno));
+ "fread() error on %s: %s", filename, g_strerror(errno));
fclose(fp);
return results;
}
// Open src file
if ((orig = fopen(src, "rb")) == NULL) {
g_debug("%s: Cannot open source file %s (%s)", __func__, src,
- strerror(errno));
+ g_strerror(errno));
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Cannot open file %s: %s", src, strerror(errno));
+ "Cannot open file %s: %s", src, g_strerror(errno));
return FALSE;
}
// Open dst file
if ((new = fopen(dst, "wb")) == NULL) {
g_debug("%s: Cannot open destination file %s (%s)", __func__, dst,
- strerror(errno));
+ g_strerror(errno));
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Cannot open file %s: %s", dst, strerror(errno));
+ "Cannot open file %s: %s", dst, g_strerror(errno));
return FALSE;
}
while ((readed = fread(buf, 1, BUFFER_SIZE, orig)) > 0) {
if (readed != BUFFER_SIZE && ferror(orig)) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Error while read %s: %s", src, strerror(errno));
+ "Error while read %s: %s", src, g_strerror(errno));
return FALSE;
}
if (fwrite(buf, 1, readed, new) != readed) {
g_debug("%s: Error while copy %s -> %s (%s)", __func__, src,
- dst, strerror(errno));
+ dst, g_strerror(errno));
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Error while write %s: %s", dst, strerror(errno));
+ "Error while write %s: %s", dst, g_strerror(errno));
return FALSE;
}
}
orig = fopen(src, "rb");
if (orig == NULL) {
g_debug("%s: Cannot open source file %s (%s)", __func__, src,
- strerror(errno));
+ g_strerror(errno));
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Cannot open %s: %s", src, strerror(errno));
+ "Cannot open %s: %s", src, g_strerror(errno));
ret = CRE_IO;
goto compress_file_cleanup;
}
while ((readed = fread(buf, 1, BUFFER_SIZE, orig)) > 0) {
if (readed != BUFFER_SIZE && ferror(orig)) {
g_debug("%s: Error while copy %s -> %s (%s)", __func__, src,
- dst, strerror(errno));
+ dst, g_strerror(errno));
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Error while read %s: %s", src, strerror(errno));
+ "Error while read %s: %s", src, g_strerror(errno));
ret = CRE_IO;
goto compress_file_cleanup;
}
new = fopen(dst, "wb");
if (!new) {
g_debug("%s: Cannot open destination file %s (%s)",
- __func__, dst, strerror(errno));
+ __func__, dst, g_strerror(errno));
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Cannot open %s: %s", src, strerror(errno));
+ "Cannot open %s: %s", src, g_strerror(errno));
ret = CRE_IO;
goto compress_file_cleanup;
}
if (fwrite(buf, 1, readed, new) != (size_t) readed) {
g_debug("%s: Error while copy %s -> %s (%s)",
- __func__, src, dst, strerror(errno));
+ __func__, src, dst, g_strerror(errno));
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Error while write %s: %s", dst, strerror(errno));
+ "Error while write %s: %s", dst, g_strerror(errno));
ret = CRE_IO;
goto compress_file_cleanup;
}
file = fopen(dst, "wb");
if (!file) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Cannot open %s: %s", dst, strerror(errno));
+ "Cannot open %s: %s", dst, g_strerror(errno));
remove(dst);
return CRE_IO;
}
CR_UNUSED(ftwbuf);
int rv = remove(fpath);
if (rv)
- g_warning("%s: Cannot remove: %s: %s", __func__, fpath, strerror(errno));
+ g_warning("%s: Cannot remove: %s: %s", __func__, fpath, g_strerror(errno));
return rv;
}
ret = nftw(path, cr_remove_dir_cb, 64, FTW_DEPTH | FTW_PHYS);
if (ret != 0) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Cannot remove dir %s: %s", path, strerror(errno));
+ "Cannot remove dir %s: %s", path, g_strerror(errno));
return CRE_IO;
}
FILE *f = fopen(filename, "w");
if (!f) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Cannot open %s: %s", filename, strerror(errno));
+ "Cannot open %s: %s", filename, g_strerror(errno));
return FALSE;
}
if (ferror(f)) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
"Cannot write content to %s: %s",
- filename, strerror(errno));
+ filename, g_strerror(errno));
ret = FALSE;
}
g_debug("%s: Removing \"%s\"", __func__, realpath);
if (remove(realpath) == -1)
- g_warning("Cannot remove \"%s\": %s", realpath, strerror(errno));
+ g_warning("Cannot remove \"%s\": %s", realpath, g_strerror(errno));
g_free(realpath);
}
cr_slist_free_full(recordstoremove, (GDestroyNotify)cr_repomd_record_free);
FD_t fd = Fopen(filename, "r.ufdio");
if (!fd) {
g_warning("%s: Fopen of %s failed %s",
- __func__, filename, strerror(errno));
+ __func__, filename, g_strerror(errno));
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Fopen failed: %s", strerror(errno));
+ "Fopen failed: %s", g_strerror(errno));
return FALSE;
}
struct stat stat_buf_own;
if (stat(filename, &stat_buf_own) == -1) {
g_warning("%s: stat(%s) error (%s)", __func__,
- filename, strerror(errno));
+ filename, g_strerror(errno));
g_set_error(err, ERR_DOMAIN, CRE_IO, "stat(%s) failed: %s",
- filename, strerror(errno));
+ filename, g_strerror(errno));
goto errexit;
}
pkg->time_file = stat_buf_own.st_mtime;
} else {
g_warning("%s: Stat on file \"%s\" failed", __func__, path);
g_set_error(err, ERR_DOMAIN, CRE_STAT,
- "Stat() on %s failed: %s", path, strerror(errno));
+ "Stat() on %s failed: %s", path, g_strerror(errno));
return CRE_STAT;
}
}
struct stat stat_buf;
if (stat(path, &stat_buf) == -1) {
g_set_error(err, ERR_DOMAIN, CRE_IO,
- "Cannot stat %s: %s", path, strerror(errno));
+ "Cannot stat %s: %s", path, g_strerror(errno));
return NULL;
}
pri_db_fd = g_mkstemp(pri_db_filename);
g_debug("%s", pri_db_filename);
if (pri_db_fd == -1) {
- g_critical("Cannot open %s: %s", pri_db_filename, strerror(errno));
+ g_critical("Cannot open %s: %s", pri_db_filename, g_strerror(errno));
exit(EXIT_FAILURE);
}
fil_db_fd = g_mkstemp(fil_db_filename);
g_debug("%s", fil_db_filename);
if (fil_db_fd == -1) {
- g_critical("Cannot open %s: %s", fil_db_filename, strerror(errno));
+ g_critical("Cannot open %s: %s", fil_db_filename, g_strerror(errno));
exit(EXIT_FAILURE);
}
oth_db_fd = g_mkstemp(oth_db_filename);
g_debug("%s", oth_db_filename);
if (oth_db_fd == -1) {
- g_critical("Cannot open %s: %s", oth_db_filename, strerror(errno));
+ g_critical("Cannot open %s: %s", oth_db_filename, g_strerror(errno));
exit(EXIT_FAILURE);
}
}