summaryrefslogtreecommitdiff
path: root/lib/libalpm/trans.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/trans.c')
-rw-r--r--lib/libalpm/trans.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 49fc0f67..3c5141a1 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -107,7 +107,7 @@ static alpm_list_t *check_arch(alpm_list_t *pkgs)
for(i = pkgs; i; i = i->next) {
pmpkg_t *pkg = i->data;
const char *pkgarch = alpm_pkg_get_arch(pkg);
- if(strcmp(pkgarch,arch) && strcmp(pkgarch,"any")) {
+ if(strcmp(pkgarch,arch) != 0 && strcmp(pkgarch,"any") != 0) {
char *string;
const char *pkgname = alpm_pkg_get_name(pkg);
const char *pkgver = alpm_pkg_get_version(pkg);
@@ -323,11 +323,11 @@ static int grep(const char *fn, const char *needle)
}
while(!feof(fp)) {
char line[1024];
- int sline = sizeof(line)-1;
- fgets(line, sline, fp);
- if(feof(fp)) {
+ if(fgets(line, sizeof(line), fp) == NULL) {
continue;
}
+ /* TODO: this will not work if the search string
+ * ends up being split across line reads */
if(strstr(line, needle)) {
fclose(fp);
return(1);
@@ -371,7 +371,7 @@ int _alpm_runscriptlet(const char *root, const char *installfn,
/* either extract or copy the scriptlet */
snprintf(scriptfn, PATH_MAX, "%s/.INSTALL", tmpdir);
- if(!strcmp(script, "pre_upgrade") || !strcmp(script, "pre_install")) {
+ if(strcmp(script, "pre_upgrade") == 0 || strcmp(script, "pre_install") == 0) {
if(_alpm_unpack_single(installfn, tmpdir, ".INSTALL")) {
retval = 1;
}