Thread (40 messages) flat view 40 messages, 4 authors, 2016-08-18

Re: [PATCH v5 03/15] pkt-line: add `gentle` parameter to format_packet()

From: Jeff King <hidden>
Date: 2016-08-10 18:35:30

On Wed, Aug 10, 2016 at 03:59:19PM +0200, Lars Schneider wrote:
quoted
It does still feel a little weird that you cannot tell the difference
between a write() error and bad input. Because you really might want to
do something different between the two. Like:

 #define MAX_FILENAME (PKTLINE_DATA_MAXLEN - strlen("filename"))

 if (filename > MAX_FILENAME) {
	warning("woah, that name is ridiculous; truncating");
	ret = packet_write_fmt_gently(fd, "%.*s", MAX_FILENAME, filename);
 } else
	ret = packet_write_fmt_gently(fd, "%s", filename);

I can do that. However, I wouldn't truncate the filename as this
might create a weird outcome. I would just let the filter fail.
Yeah, I think that is probably fine (I don't have a real opinion for
this particular case, but was mostly just trying to think about whether
the pktline interface was suitably flexible).

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help