diff options
| author | Paul Eggert | 2011-04-16 14:20:25 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-16 14:20:25 -0700 |
| commit | 5a9c1e26a73394d076607fa027b8d7848231c2f8 (patch) | |
| tree | 131e7fc2ac8954a7e6159611807595f22935752c /lib-src | |
| parent | cd52b2441e95f407c0332534ae1997023fe62461 (diff) | |
| download | emacs-5a9c1e26a73394d076607fa027b8d7848231c2f8.tar.gz emacs-5a9c1e26a73394d076607fa027b8d7848231c2f8.zip | |
* movemail.c (mail_spool_name): Protoize.
(main): Remove unused var. Mark var as initialized.
Move locals to avoid shadowing, and use time_t for times.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 4 | ||||
| -rw-r--r-- | lib-src/movemail.c | 20 |
2 files changed, 18 insertions, 6 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 2e3c62d414e..456e286503b 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2011-04-16 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-04-16 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * movemail.c (mail_spool_name): Protoize. | ||
| 4 | (main): Remove unused var. Mark var as initialized. | ||
| 5 | Move locals to avoid shadowing, and use time_t for times. | ||
| 6 | |||
| 3 | * fakemail.c (xmalloc, xreallc): Use standard C prototypes | 7 | * fakemail.c (xmalloc, xreallc): Use standard C prototypes |
| 4 | with void *. This avoids warnings about pointer casts. | 8 | with void *. This avoids warnings about pointer casts. |
| 5 | 9 | ||
diff --git a/lib-src/movemail.c b/lib-src/movemail.c index 4a894c1cba1..4cf97cbac18 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c | |||
| @@ -131,7 +131,7 @@ extern int lk_open (), lk_close (); | |||
| 131 | files appear in. */ | 131 | files appear in. */ |
| 132 | #ifdef MAILDIR | 132 | #ifdef MAILDIR |
| 133 | #define MAIL_USE_MAILLOCK | 133 | #define MAIL_USE_MAILLOCK |
| 134 | static char *mail_spool_name (); | 134 | static char *mail_spool_name (char *); |
| 135 | #endif | 135 | #endif |
| 136 | #endif | 136 | #endif |
| 137 | 137 | ||
| @@ -167,7 +167,6 @@ main (int argc, char **argv) | |||
| 167 | 167 | ||
| 168 | #ifndef MAIL_USE_SYSTEM_LOCK | 168 | #ifndef MAIL_USE_SYSTEM_LOCK |
| 169 | struct stat st; | 169 | struct stat st; |
| 170 | long now; | ||
| 171 | int tem; | 170 | int tem; |
| 172 | char *lockname, *p; | 171 | char *lockname, *p; |
| 173 | char *tempname; | 172 | char *tempname; |
| @@ -259,7 +258,13 @@ main (int argc, char **argv) | |||
| 259 | #ifndef MAIL_USE_SYSTEM_LOCK | 258 | #ifndef MAIL_USE_SYSTEM_LOCK |
| 260 | #ifdef MAIL_USE_MAILLOCK | 259 | #ifdef MAIL_USE_MAILLOCK |
| 261 | spool_name = mail_spool_name (inname); | 260 | spool_name = mail_spool_name (inname); |
| 262 | if (! spool_name) | 261 | if (spool_name) |
| 262 | { | ||
| 263 | #ifdef lint | ||
| 264 | lockname = 0; | ||
| 265 | #endif | ||
| 266 | } | ||
| 267 | else | ||
| 263 | #endif | 268 | #endif |
| 264 | { | 269 | { |
| 265 | #ifndef DIRECTORY_SEP | 270 | #ifndef DIRECTORY_SEP |
| @@ -336,7 +341,7 @@ main (int argc, char **argv) | |||
| 336 | by time differences between machines. */ | 341 | by time differences between machines. */ |
| 337 | if (stat (lockname, &st) >= 0) | 342 | if (stat (lockname, &st) >= 0) |
| 338 | { | 343 | { |
| 339 | now = time (0); | 344 | time_t now = time (0); |
| 340 | if (st.st_ctime < now - 300) | 345 | if (st.st_ctime < now - 300) |
| 341 | unlink (lockname); | 346 | unlink (lockname); |
| 342 | } | 347 | } |
| @@ -352,7 +357,10 @@ main (int argc, char **argv) | |||
| 352 | int lockcount = 0; | 357 | int lockcount = 0; |
| 353 | int status = 0; | 358 | int status = 0; |
| 354 | #if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK) | 359 | #if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK) |
| 355 | time_t touched_lock, now; | 360 | time_t touched_lock; |
| 361 | # ifdef lint | ||
| 362 | touched_lock = 0; | ||
| 363 | # endif | ||
| 356 | #endif | 364 | #endif |
| 357 | 365 | ||
| 358 | if (setuid (getuid ()) < 0 || setregid (-1, real_gid) < 0) | 366 | if (setuid (getuid ()) < 0 || setregid (-1, real_gid) < 0) |
| @@ -462,7 +470,7 @@ main (int argc, char **argv) | |||
| 462 | #if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK) | 470 | #if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK) |
| 463 | if (spool_name) | 471 | if (spool_name) |
| 464 | { | 472 | { |
| 465 | now = time (0); | 473 | time_t now = time (0); |
| 466 | if (now - touched_lock > 60) | 474 | if (now - touched_lock > 60) |
| 467 | { | 475 | { |
| 468 | touchlock (); | 476 | touchlock (); |