Merge branch 'master' of github.com:voidlinux/xbps
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2012-2013 Juan Romero Pardines.
|
||||
* Copyright (c) 2012-2015 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,6 +43,7 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
|
||||
const char *tmpdir, *version;
|
||||
char *pkgname, *fpath;
|
||||
int fd, rv;
|
||||
mode_t mask;
|
||||
|
||||
assert(blob);
|
||||
assert(pkgver);
|
||||
@@ -71,12 +72,15 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
|
||||
}
|
||||
|
||||
/* Create temp file to run script */
|
||||
mask = umask(S_IXUSR|S_IRWXG|S_IRWXO);
|
||||
if ((fd = mkstemp(fpath)) == -1) {
|
||||
umask(mask);
|
||||
rv = errno;
|
||||
xbps_dbg_printf(xhp, "%s: mkstemp %s\n",
|
||||
__func__, strerror(errno));
|
||||
goto out;
|
||||
}
|
||||
umask(mask);
|
||||
/* write blob to our temp fd */
|
||||
ret = write(fd, blob, blobsiz);
|
||||
if (ret == -1) {
|
||||
|
||||
@@ -291,7 +291,7 @@ unpack_archive(struct xbps_handle *xhp,
|
||||
*/
|
||||
if (file_exists &&
|
||||
((entry_statp->st_mode & S_IFMT) != (st.st_mode & S_IFMT)))
|
||||
remove(entry_pname);
|
||||
(void)remove(entry_pname);
|
||||
|
||||
if (!force && (entry_type == AE_IFREG)) {
|
||||
buf = strchr(entry_pname, '.') + 1;
|
||||
|
||||
@@ -158,6 +158,7 @@ pkgdb_map_vpkgs(struct xbps_handle *xhp)
|
||||
|
||||
xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
|
||||
pkgname = xbps_pkg_name(pkgver);
|
||||
assert(pkgname);
|
||||
|
||||
for (unsigned int i = 0; i < xbps_array_count(provides); i++) {
|
||||
const char *vpkg;
|
||||
|
||||
@@ -600,7 +600,7 @@ _prop_object_internalize_by_tag(struct _prop_object_internalize_context *ctx)
|
||||
|
||||
match_start:
|
||||
for (poi = _prop_object_internalizer_table;
|
||||
poi->poi_tag != NULL; poi++) {
|
||||
poi != NULL && poi->poi_tag != NULL; poi++) {
|
||||
if (_prop_object_internalize_match(ctx->poic_tagname,
|
||||
ctx->poic_tagname_len,
|
||||
poi->poi_tag,
|
||||
@@ -849,8 +849,12 @@ _prop_object_externalize_write_file(const char *fname, const char *xml,
|
||||
strcat(tname, PLISTTMP);
|
||||
#undef PLISTTMP
|
||||
|
||||
if ((fd = mkstemp(tname)) == -1)
|
||||
myumask = umask(S_IXUSR|S_IRWXG|S_IRWXO);
|
||||
if ((fd = mkstemp(tname)) == -1) {
|
||||
umask(myumask);
|
||||
return (false);
|
||||
}
|
||||
umask(myumask);
|
||||
|
||||
if (do_compress) {
|
||||
if ((gzf = gzdopen(fd, "a")) == NULL)
|
||||
|
||||
@@ -127,7 +127,6 @@ xbps_rpool_release(struct xbps_handle *xhp _unused)
|
||||
while ((repo = SIMPLEQ_FIRST(&rpool_queue))) {
|
||||
SIMPLEQ_REMOVE(&rpool_queue, repo, xbps_repo, entries);
|
||||
xbps_repo_close(repo);
|
||||
free(repo);
|
||||
}
|
||||
if (xhp->repositories)
|
||||
xbps_object_release(xhp->repositories);
|
||||
|
||||
@@ -121,8 +121,12 @@ xbps_transaction_package_replace(struct xbps_handle *xhp, xbps_array_t pkgs)
|
||||
*/
|
||||
xbps_dictionary_set_cstring_nocopy(instd,
|
||||
"transaction", "remove");
|
||||
if (!xbps_array_add_first(pkgs, instd))
|
||||
if (!xbps_array_add_first(pkgs, instd)) {
|
||||
xbps_object_iterator_release(iter);
|
||||
free(pkgname);
|
||||
free(curpkgname);
|
||||
return EINVAL;
|
||||
}
|
||||
free(curpkgname);
|
||||
}
|
||||
xbps_object_iterator_release(iter);
|
||||
|
||||
@@ -437,7 +437,7 @@ xbps_sanitize_path(const char *src)
|
||||
len = strlen(src);
|
||||
assert(len != 0);
|
||||
|
||||
dest = malloc(len);
|
||||
dest = malloc(len+1);
|
||||
assert(dest);
|
||||
d = dest;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user