Ben Pfaff <blp <at> cs.stanford.edu> writes: > > + size_t len = strlen (name); > > + if (name[len - 1] == '/') > > + { > > If name is "" then the "if" statement will reference name[-1].
Thanks. I've rebased my working copy to do: if (len && name[len - 1] == '/') as well as audited other modules where I've recently added trailing slash checks. Ones like rpl_lstat are already safe - they do the original lstat first (which fails with ENOENT) and check slash later; but symlink has to check slash first (so that it doesn't create garbage). > > + if (symlink ("nowhere", BASE "link1")) > > + { > > + fputs ("skipping test: symlinks not supported on this filesystem\n", > > + stderr); > > Should this print the specific error that was encountered? I > suspect that might be handy for debugging. It's pretty much the same error for multiple tests, but yes, I could add a patch to add a strerror on the errno when symlink() and/or link() fail. -- Eric Blake