summaryrefslogtreecommitdiffstats
path: root/dotlock.c
AgeCommit message (Collapse)Author
2022-01-29Fix argc==0 handling.Kevin McCarthy
At least on Debian Linux, after invoking getopt() with argc==0, optind seems to remain at the default value of 1. mutt_dotlock was checking for optind==argc to report a missing parameter, and would end up invoking the function with the first environment variable instead. mutt, pgpewrap, and mutt_pgpring were assuming argv[0] was non-null, so just add a check and hardcode the value in that case to avoid a possible segv. mutt_pgpring allows no arguments. Its parameters to pgpring_find_candidates() would pass the environment list and a negative nhints in that case. The code seem to handle the case, but set optind=argc to be clear about it.
2021-07-22Revert "Silence strfcpy() warning in dotlock_deference_symlink()."Kevin McCarthy
This reverts commit 8970a4793c302c0bb8619a5dde56c8ca8de20532. I didn't like making this nonsensical change, just to silence the compiler. The last commit should turn off the warning for systems with memccpy().
2021-07-22Use memccpy() in the strfcpy macro if it's available.Kevin McCarthy
Thanks to Ian Collier for making this suggestion! It's more efficient and disables unhelpful compiler warnings about strncpy(), since strfcpy is terminating the string itself. If memccpy() is unavailable, use strncpy() but keep the old behavior of strncpy() length C instead of C-1, as I believe it tickles less compiler warnings. Add parenthesis around macro parameter uses, to be safe. Thanks to Vincent Lefèvre for pointing that out.
2021-07-22Fix typo in comment and function name: deference -> dereference.Vincent Lefevre
2021-07-21Silence strfcpy() warning in dotlock_deference_symlink().Kevin McCarthy
The compiler is being a bit strange, only picking out and warning about the 'strfcpy (d, pathptr, l);' line at the bottom of the function, even though the source and dest are the same size. It seems a shame to leave just this last one, since all the other warnings (at least on Debian) have been vanquished. So, to calm the compiler down, "russian doll" the buffer size down the call stack "dotlock_dispatch() -> dotlock_prepare() -> dotlock_deference_symlink()".
2021-01-14Remove snprintf and vsnprintf configure checks.Kevin McCarthy
There was a period of time where C99 was standardized but some systems still didn't include a correctly working version of those two functions. But I think we are long past that point now. Remove the checks and replacement code.
2019-12-18Revert "Fixes unchecked return from link() in dotlock.c"Kevin McCarthy
This reverts commit 317b7f6b53d8a4272acf8ef1b56f3406e9bc2691.
2019-11-13Fixes unchecked return from link() in dotlock.cDavid Champion
2019-04-11Generate version string during make not configureAaron Schrab
Switch to generating the version string during make process rather than at configure time. This makes it easier to keep the detailed version string accurate when doing development which doesn't require that the configure script be rerun.
2019-01-04Clean up formatting.Kevin McCarthy
Add spaces after if, else, while, for, switch. Unify the brace placement style. The vast majority of the code uses Allman style so convert the relatively few K&R braces over.
2019-01-04Clean up code indentation.Kevin McCarthy
These are mostly automated changes corresponding to the emacs settings: (c-set-style "linux") (setq c-basic-offset 2) (c-set-offset 'case-label '+) Most of the code follows the convention: (add-to-list 'c-cleanup-list 'space-before-funcall) but this is not enforced by this indentation cleanup. Also, I personally dislike tabs, so I have: (setq-default indent-tabs-mode nil) in my own configuration. However I have no desire to change every line just for that effect. So this cleanup does nothing about the mix issue. Some of the secondary files (e.g. regex.c) have been skipped. I've also skipped crypt-gpgme.c, because I need to think about that file. Werner Koch and the GnuPG team contributed most it, and it follows the Gnu indentation settings. It should probably be made uniform with Mutt, but I don't want to discourage future GnuPG contribution to the file. I manually reverted a few unsightly cleanups, and added a few tweeks when I saw things that could be improved.
2018-12-31Remove trailing whitespace.Kevin McCarthy
The result of find . -name "*.[ch]" -exec emacs -batch {} \ --eval="(progn (delete-trailing-whitespace) (and (buffer-modified-p) (save-buffer)))" \;
2016-11-17Backout inlining of MUTT_VERSION in 42fee7585fae.Kevin McCarthy
If MUTT_VERSION contains a %, this will result in problems.
2016-11-13search muttrc file according to XDG Base Specification (closes #3207)Damien Riegel
First of all, the MUTT_VERSION symbol is now concatenated (when possible) at compile time. Then, the logic to find the config file has been changed a bit to remove unnecessary calls to access(), so now each possible locations for the config file is only tested once, and it stops as soon as a valid one has been found. So instead of: access("/home/dkc/.muttrc-1.7.1", F_OK) = -1 ENOENT (No such file or directory) access("/home/dkc/.muttrc", F_OK) = 0 access("/home/dkc/.muttrc", F_OK) = 0 access("/home/dkc/.muttrc", F_OK) = 0 [... Tests for Muttrc ... ] access("/home/dkc/.muttrc", F_OK) = 0 We now have: access("/home/dkc/.muttrc-1.7+13 (f658e517960e)", F_OK) = -1 ENOENT (No such file or directory) access("/home/dkc/.muttrc", F_OK) = 0 It also cleans up the case where -F is passed on the command line but points to a non-existent file by moving the error path closer to the actual fail condition. Finally, it adds partial support for the XDG Base Directory Specification. mutt will now try to locate its config at: $XDG_CONFIG_HOME/mutt/muttrc-MUTT_VERSION $XDG_CONFIG_HOME/mutt/muttrc. If XDG_CONFIG_HOME is not set, it will use '~/.config' as a default.
2011-03-07Extra information in mutt version string, redux.David Champion
Restores [f1b4d1d17200] functionality with a slight change to keep 'make dist' working (see backout in [6b38124a5b81]). Automake is too much voodoo for me at this time, so I let it keep VERSION. mutt.h defined MUTT_VERSION as VERSION and the code used that, so I removed MUTT_VERSION from mutt.h and put it into config.h via configure.ac. A couple of tweaks were needed elsewhere. This restores the fancy-versioning feature within mutt and keeps 'make dist' happy.
2009-01-04Update copyrights. Closes #3016.Brendan Cully
I went through the logs of each file with a copyright header and updated the years for the authors in the headers for any non-comment changes they introduced. What a pain!
2007-08-28Use limits.h for PATH_MAX instead of posix1_lim.h (closes #2525)Brendan Cully
2007-06-27remove a double inclusion of config.hDan Fandrich
2007-01-26Fix #2710, of-by-one in dotlock.c.Thomas Roessler
2005-09-17Gah, forgot the zip code when updating the FSF address...Brendan Cully
2005-09-17Update FSF address (via sed, I hope nothing got mangled). Closes: #2071.Brendan Cully
2005-02-03Add config.h to the top of every C file that could possibly want it.Brendan Cully
Remove it from mutt.h
2002-12-11Fix Mike's and my e-mail addresses in copyright lines.Thomas Roessler
2001-01-08Let check_sec.sh check for use of the unsafe malloc, realloc, free,Thomas Roessler
and strdup routines. While we are on it, plug some memory leaks and make some code understandable.
2000-03-03The FSF apparently has moved.Thomas Roessler
2000-01-24Locking fix.Thomas Roessler
2000-01-06Update copyright notices for unstable.Thomas Roessler
1999-11-18indentation noise.Thomas Roessler
1999-09-02Remove a superfluous label.Thomas Roessler
1999-08-23Remove a couple of NFS-related hacks which seem to be unnecessary.Thomas Roessler
1999-08-15Commit remaining changes.Thomas Roessler
1999-08-15Really fix $save_empty, even when the dotlocking code is compiledThomas Roessler
into mutt.
1999-08-04Fix $save_empty.Thomas Roessler
1999-07-26Impose a hard limit on dotlock attempts.Thomas Roessler
1999-01-07Get rid of RCS ids in source files. They are getting in our wayThomas Roessler
when merging changes.
1998-11-10Don't use mutt_strsomething in the dotlocking code.Thomas Roessler
1998-11-10Introduce or rewrite mutt_{str*cmp,strlen} and use them all over theThomas Roessler
place. If there are still segmentation faults due to missing NONULLs over, they are gone now.
1998-10-27include config.h _before_ checking for HAVE_GETOPT. Noted by ScottThomas Roessler
Perlman <perlman@linguist.dartmouth.edu>.
1998-10-15Change "static char rcsid[]" to "static const char rcsid[]" to makemutt-0-94-13-relThomas Roessler
gcc shut up about this.
1998-10-14Various build fixes.Thomas Roessler
1998-10-13Add RCS $Id$ strings to (hopefully) all source files.Thomas Roessler
1998-08-25CVS branch clean-up.Thomas Roessler