This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] cygcheck.cc update for cygpath()


Corinna Vinschen wrote:

> Btw., you don't need to make the buffers MAX_PATH + 1.  MAX_PATH is
> defined including the trailing NUL.  Existing code shows a lot of
> irritation about this...

Oh, I wasn't even thinking of that... the reason I used MAX_PATH + 1 was
because earlier I had written

+      static char tmp[SYMLINK_MAX + 1];

so that the following sizes would not need to be SYMLINK_MAX - 1, 

+      if (!readlink (fh, tmp, SYMLINK_MAX))

+	  strncpy (tmp, cygpath (papp, NULL), SYMLINK_MAX);

+	  strncpy (lastsep+1, ptr, SYMLINK_MAX - (lastsep-tmp));


I.e. pure lazyness of wanting to type the least necessary.  But now that
you mention it, it makes more sense to have the "- 1" than the "+ 1"
form, so I'll change that.

Brian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]