summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2013-08-12 13:09:01 +0200
committerAllan McRae <allan@archlinux.org>2013-08-21 03:14:01 +0200
commitce7456b4ccbe3ca7b06c9b50fe59ce7367172c4f (patch)
treebc008fc50e51375f6f54985289539e8c66709d35 /src
parentd8c2ab0e6f52d9a790b608c254761ab4888bd547 (diff)
downloadpacman-ce7456b4ccbe3ca7b06c9b50fe59ce7367172c4f.tar.gz
pacman-ce7456b4ccbe3ca7b06c9b50fe59ce7367172c4f.tar.xz
Store fgetc output as an int.
Bug exposed on ARM when char is unsigned resulting in the comparison to EOF always failing. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/pacman.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 5ce8747b..24fd57f4 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -830,13 +830,15 @@ int main(int argc, char *argv[])
int target_found = 0;
size_t current_size = PATH_MAX;
char *vdata, *line = malloc(current_size);
+ int c;
/* remove the '-' from the list */
pm_targets = alpm_list_remove_str(pm_targets, "-", &vdata);
free(vdata);
i = 0;
- while((line[i] = (char)fgetc(stdin)) != EOF) {
+ while((c = fgetc(stdin)) != EOF) {
+ line[i] = (char)c;
if(isspace((unsigned char)line[i])) {
/* avoid adding zero length arg when multiple spaces separate args */
if(i > 0) {