mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 08:18:51 -05:00
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>
This commit is contained in:
parent
d8c2ab0e6f
commit
ce7456b4cc
@ -830,13 +830,15 @@ int main(int argc, char *argv[])
|
|||||||
int target_found = 0;
|
int target_found = 0;
|
||||||
size_t current_size = PATH_MAX;
|
size_t current_size = PATH_MAX;
|
||||||
char *vdata, *line = malloc(current_size);
|
char *vdata, *line = malloc(current_size);
|
||||||
|
int c;
|
||||||
|
|
||||||
/* remove the '-' from the list */
|
/* remove the '-' from the list */
|
||||||
pm_targets = alpm_list_remove_str(pm_targets, "-", &vdata);
|
pm_targets = alpm_list_remove_str(pm_targets, "-", &vdata);
|
||||||
free(vdata);
|
free(vdata);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while((line[i] = (char)fgetc(stdin)) != EOF) {
|
while((c = fgetc(stdin)) != EOF) {
|
||||||
|
line[i] = (char)c;
|
||||||
if(isspace((unsigned char)line[i])) {
|
if(isspace((unsigned char)line[i])) {
|
||||||
/* avoid adding zero length arg when multiple spaces separate args */
|
/* avoid adding zero length arg when multiple spaces separate args */
|
||||||
if(i > 0) {
|
if(i > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user