Denys Vlasenko <[email protected]> writes:
> On 07/18/2012 01:01 PM, Jakub Filak wrote:
>> + if (response)
>> + {
>> + size_t len = strlen(response);
>> + response[len++] = '\n';
>> +
>> + if (full_write(state->command_in_fd, response, len) != len)
>> + perror_msg_and_die("Can't write %lu bytes to child's
>> stdin", len);
>
> %lu means "unsigned long". I would add a cast: (unsigned long)len.
or without casting, you can use %zu, which is intend for size_t type
>> +
>> + free(response);
>> + }
>> +
>> free(buf);
>> }
>> fclose(fp); /* Got EOF, close. This also closes state->command_out_fd */
>> @@ -612,3 +607,44 @@ char *list_possible_events(struct dump_dir *dd, const
>> char *dump_dir_name, const
>>
>> return strbuf_free_nobuf(result);
>> }
>> +
>> +void run_event_stdio_alert(const char *msg, void *param)
>> +{
>> + printf("%s\n", msg);
>> + fflush(stdout);
>> +}
>> +
>> +char *run_event_stdio_ask(const char *msg, void *param)
>> +{
>> + printf("%s ", msg);
>> + fflush(stdout);
>> + char buf[256];
>> + if (!safe_read(STDIN_FILENO, buf, sizeof(buf)))
>
> If you name them ..._stdio_..., I would use stdio functions consistently
> in all callbacks. Here, I'd use fgets, not safe_read.
--
Nikola