unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: emacs-devel@gnu.org
Subject: Bug in filelock.c
Date: Sat, 23 Feb 2013 21:07:09 +0200	[thread overview]
Message-ID: <83zjyukfxe.fsf@gnu.org> (raw)

The marked line from filelock.c seems to have such a glaring bug that
I'm questioning my own judgment:

  /* Shift the nondirectory part of the file name (including the null)
     right two characters.  Here is one of the places where we'd have to
     do something to support 14-character-max file names.  */
  for (p = lockfile + length; p != lockfile && *p != '/'; p--)
    p[2] = *p;

  /* Insert the `.#'.  */
  p[1] = '.';
  p[2] = '#';

  p = p + length + 2;
  ^^^^^^^^^^^^^^^^^^

I think it should say this instead:

  p = lockfile + length + 2

I guess no one ever had a situation where a numeric tail was needed,
because then fill_in_lock_file_name would corrupt the stack.  Or maybe
on most machines nowadays arguments are not passed on the stack, even
in a non-optimized build.

Am I missing something?



             reply	other threads:[~2013-02-23 19:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-23 19:07 Eli Zaretskii [this message]
2013-02-23 19:39 ` Bug in filelock.c Paul Eggert
2013-02-23 20:23   ` Eli Zaretskii
2013-02-23 21:59   ` Andreas Schwab
2013-02-24  0:25     ` Paul Eggert
2013-02-24  3:46       ` Eli Zaretskii
2013-02-24  7:30         ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83zjyukfxe.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).