plug-ins: fix sendmail alternative.

Oups! I should have retested --with-sendmail before pushing, after the
changes in commit 05f7726.
This commit is contained in:
Jehan 2016-05-27 21:57:06 +02:00
parent d6ee1dc5cf
commit 22905e7174
1 changed files with 10 additions and 7 deletions

View File

@ -80,7 +80,7 @@ static gchar * find_extension (const gchar *filename);
static void mesg_body_callback (GtkTextBuffer *buffer,
gpointer data);
static gchar * sendmail_content_type (const gchar *filename)
static gchar * sendmail_content_type (const gchar *filename);
static void sendmail_create_headers (FILE *mailpipe);
static gboolean sendmail_to64 (const gchar *filename,
FILE *outfile,
@ -292,7 +292,7 @@ send_image (const gchar *filename,
#else /* SENDMAIL */
gchar *mailcmd[3];
GPid mailpid;
FILE *mailpipe;
FILE *mailpipe = NULL;
#endif
GError *error = NULL;
@ -410,11 +410,11 @@ send_image (const gchar *filename,
if (mailpipe == NULL)
return GIMP_PDB_EXECUTION_ERROR;
create_headers (mailpipe);
sendmail_create_headers (mailpipe);
fflush (mailpipe);
if (! to64 (tmpname, mailpipe, &error))
if (! sendmail_to64 (tmpname, mailpipe, &error))
{
g_message ("%s", error->message);
g_error_free (error);
@ -436,9 +436,12 @@ error:
cleanup:
/* close out the sendmail process */
#ifdef SENDMAIL
fclose (mailpipe);
waitpid (mailpid, NULL, 0);
g_spawn_close_pid (mailpid);
if (mailpipe)
{
fclose (mailpipe);
waitpid (mailpid, NULL, 0);
g_spawn_close_pid (mailpid);
}
/* delete the tmpfile that was generated */
g_unlink (tmpname);