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

patch.
This commit is contained in:
Michael Elkins 2002-06-22 17:06:24 +00:00
parent eb5f92821c
commit d6fd1939ba
2 changed files with 17 additions and 6 deletions

View File

@ -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;

17
imap.c
View File

@ -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);
}
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);
}