Re: [PATCH 5/7] maintenance: add start/stop subcommands
SZEDER Gábor <szeder.dev@gmail.com> writes:
Show 28 quoted lines
>> +int cmd__crontab(int argc, const char **argv)
>> +{
>> + char a;
>
> So 'a' is a char...
>
>> + FILE *from, *to;
>> +
>> + if (argc == 3 && !strcmp(argv[2], "-l")) {
>> + from = fopen(argv[1], "r");
>> + if (!from)
>> + return 0;
>> + to = stdout;
>> + } else if (argc == 2) {
>> + from = stdin;
>> + to = fopen(argv[1], "w");
>> + } else
>> + return error("unknown arguments");
>> +
>> + while ((a = fgetc(from)) != EOF)
>
> fgetc() returns an int, which is assigned to a char, which is then
> compared to whatever EOF might be on the platform. Apparently this
> casting and comparison doesn't work as expected on s390x (I haven't
> even tried to think it through...), and instead of detecting EOF and
> exiting we end up in an endless loop writing 0xff bytes to 'cron.txt',
> while 'git maintenance start' in vain waits for 'test-crontab' to
> exit.Ah, is this fun with unsigned char never comparing equal to -1?