mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
Various small fixes as suggested by some static code checkers
I ran flawfinder and sparse over the pacman source code and found a few things that were worth fixing (and were quick fixes). Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
6b7b974318
commit
15e1ce2e70
@ -23,13 +23,6 @@
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#if defined(__APPLE__) || defined(__OpenBSD__)
|
||||
#include <sys/syslimits.h>
|
||||
#endif
|
||||
#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__sun__)
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -44,7 +44,7 @@ enum _pmerrno_t pm_errno SYMEXPORT;
|
||||
* functions are called.
|
||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
||||
*/
|
||||
int SYMEXPORT alpm_initialize()
|
||||
int SYMEXPORT alpm_initialize(void)
|
||||
{
|
||||
ASSERT(handle == NULL, RET_ERR(PM_ERR_HANDLE_NOT_NULL, -1));
|
||||
|
||||
@ -59,7 +59,7 @@ int SYMEXPORT alpm_initialize()
|
||||
/** Release the library. This should be the last alpm call you make.
|
||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
||||
*/
|
||||
int SYMEXPORT alpm_release()
|
||||
int SYMEXPORT alpm_release(void)
|
||||
{
|
||||
int dbs_left = 0;
|
||||
|
||||
|
@ -56,7 +56,7 @@ typedef struct __pmgraph_t pmgraph_t;
|
||||
* Library
|
||||
*/
|
||||
|
||||
int alpm_initialize();
|
||||
int alpm_initialize(void);
|
||||
int alpm_release(void);
|
||||
|
||||
/*
|
||||
|
@ -85,7 +85,7 @@ char *mkdtemp(char *template)
|
||||
/* Save template */
|
||||
(void) strcpy(t, template);
|
||||
for (; ; ) {
|
||||
r = mktemp(template);
|
||||
r = mkstemp(template);
|
||||
|
||||
if (*r == '\0')
|
||||
return (NULL);
|
||||
@ -156,21 +156,21 @@ int _alpm_copyfile(const char *src, const char *dest)
|
||||
while((len = fread(buf, 1, 4096, in))) {
|
||||
fwrite(buf, 1, len, out);
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
|
||||
/* chmod dest to permissions of src, as long as it is not a symlink */
|
||||
struct stat statbuf;
|
||||
if(!stat(src, &statbuf)) {
|
||||
if(! S_ISLNK(statbuf.st_mode)) {
|
||||
chmod(dest, statbuf.st_mode);
|
||||
fchmod(fileno(out), statbuf.st_mode);
|
||||
}
|
||||
} else {
|
||||
/* stat was unsuccessful */
|
||||
fclose(out);
|
||||
return(1);
|
||||
}
|
||||
|
||||
fclose(out);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user