Re: [PATCH v4 4/4] convert: add "status=delayed" to filter process protocol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 22 May 2017, at 21:58, Torsten Bögershausen <tboegi@xxxxxx> wrote:
> 
> On 2017-05-22 15:50, Lars Schneider wrote:
>> +
>> +int async_query_available_blobs(const char *cmd, struct string_list *delayed_paths)
>> +{
>> +	int err;
>> +	char *line;
>> +	struct cmd2process *entry;
>> +	struct child_process *process;
>> +	struct strbuf filter_status = STRBUF_INIT;
>> +
>> +	entry = find_multi_file_filter_entry(&cmd_process_map, cmd);
>> +	if (!entry) {
>> +		error("external filter '%s' is not available anymore although "
>> +		      "not all paths have been filtered", cmd);
>> +		return 0;
>> +	}
>> +	process = &entry->process;
>> +	sigchain_push(SIGPIPE, SIG_IGN);
>> +
>> +	err = packet_write_fmt_gently(
>> +		process->in, "command=list_available_blobs\n");
>> +	if (err)
>> +		goto done;
>> +
>> +	err = packet_flush_gently(process->in);
>> +	if (err)
>> +		goto done;
>> +
>> +	for (;;) {
>> +		const char* pre = "pathname=";
>> +		const int pre_len = strlen(pre);
>> +		line = packet_read_line(process->out, NULL);
>> +		if (!line)
>> +			break;
>> +		err = strlen(line) <= pre_len || strncmp(line, pre, pre_len);
>> +		if (err)
>> +			goto done;
>> +		string_list_insert(delayed_paths, xstrdup(line+pre_len));
>> +	}
>> +
>> +	read_multi_file_filter_status(process->out, &filter_status);
>> +	err = strcmp(filter_status.buf, "success");
>> +
>> +done:
>> +	sigchain_pop(SIGPIPE);
>> +
>> +	if (err || errno == EPIPE) {
> 
> This looks strange, at first glance.
> Do we set errno to 0 before ?
> Or is there a trick that EPIPE can only be reached,
> if it is "our" error ?

You are right and I'll fix it! 
Thanks for reminding me! 
Peff also noticed that some time ago:
http://public-inbox.org/git/20170411200520.oivytvlzkdu7bfh5@xxxxxxxxxxxxxxxxxxxxx/

Thanks,
Lars



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]