isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit d6fd1939ba20854d4267952046783892cf1191f7
parent eb5f92821c547676b16778f19503ea796edaec12
Author: Michael Elkins <me@mutt.org>
Date:   Sat, 22 Jun 2002 17:06:24 +0000

fixed errors introduced by ME when hand-applying Oswald Nuddenhagen's
patch.

Diffstat:
Mdotlock.c | 4++--
Mimap.c | 19+++++++++++++++----
2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/dotlock.c b/dotlock.c @@ -53,7 +53,7 @@ int dotlock_unlock (int *fd) if (*fd != -1) { lck.l_type = F_UNLCK; - if (fcntl (*fd, F_SETLKW, &lck)) + if (fcntl (*fd, F_SETLK, &lck)) r = -1; close (*fd); *fd = -1; @@ -71,7 +71,7 @@ int main (void) perror ("dotlock_lock"); goto done; } - puts("sleeping for 5 seconds"); + puts ("sleeping for 5 seconds"); sleep(5); if (dotlock_unlock (&fd)) { diff --git a/imap.c b/imap.c @@ -633,12 +633,13 @@ imap_open (config_t * box, unsigned int minuid, imap_t * imap, int flags) if (fork () == 0) { - if (dup2 (a[0],0) || dup2 (a[0], 1)) + if (dup2 (a[0], 0) == -1 || dup2 (a[0], 1) == -1) { - _exit(127); + _exit (127); } + close (a[0]); close (a[1]); - execl ("/bin/sh", "sh", "-c", box->tunnel); + execl ("/bin/sh", "sh", "-c", box->tunnel, 0); _exit (127); } @@ -796,14 +797,24 @@ imap_open (config_t * box, unsigned int minuid, imap_t * imap, int flags) * if we don't have a global password set, prompt the user for * it now. */ - if (!global.pass) + if (!global.pass || !*global.pass) { global.pass = getpass ("Password:"); if (!global.pass) { + perror ("getpass"); + exit (1); + } + if (!*global.pass) + { fprintf (stderr, "Skipping %s, no password", box->path); break; } + /* + * getpass() returns a pointer to a static buffer. make a copy + * for long term storage. + */ + global.pass = strdup (global.pass); } box->pass = strdup (global.pass); }