Gary R. Van Sickle wrote:
More investigation reveals that it's textmode mounts that alternatives
doesn't like, not necessarily (although almost certainly as well as) \r\n
line endings.
I'm pretty sure the problem is here:
if (read(fd, buf, sb.st_size) != sb.st_size) {
close(fd);
fprintf(stderr, _("failed to read %s: %s\n"), path,
strerror(errno));
return 1;
}
Since one effect of 'textmode' conversions is that the bytecount "read"
differs from the size reported by the filesystem, textmode files will
always fail this test.
(1) I could remove this test -- but then you lose the error checking
it's attempting to do: make sure the entire file was read into buf, and
nothing was lost.
(2) I could always open the file in binmode, and change the parseLine
routine to ignore trailing '\r' on each line. (We'll assume that no
alternatives config file will ever contain a vertical-feed character).
Suggestions?
--
Chuck
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/