aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-06-16 06:48:12 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-06-16 06:48:12 +0000
commit2a9f172298a5e2121f1684863da358df56f10697 (patch)
tree3bd5200442bd913b0ce6da7e4fd620dadc4596b2
parent899f239a05c28f5ae8ec43bb7719e5ce0da0b2e5 (diff)
check exit status to detect errors when send messages using commands.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@347 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.ja5
-rw-r--r--src/send_message.c14
3 files changed, 22 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b659b4c6..32746720 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2005-06-16
+ * src/send_message.c: send_message_local(): check exit status to
+ detect errors.
+
+2005-06-16
+
* src/procmsg.c: procmsg_empty_trash(): unset dirty flag after cleared
cache/mark files (fixed wrong unread count of trash folders).
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 52e65ab7..cb0458a4 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,10 @@
2005-06-16
+ * src/send_message.c: send_message_local(): 終了ステータスをチェック
+ してエラーを検出するようにした。
+
+2005-06-16
+
* src/procmsg.c: procmsg_empty_trash(): キャッシュ/マークファイルを
クリアした後 dirty フラグを解除するようにした(ごみ箱フォルダの
未読数がおかしくなるのを修正)。
diff --git a/src/send_message.c b/src/send_message.c
index 81940763..3faef99d 100644
--- a/src/send_message.c
+++ b/src/send_message.c
@@ -30,6 +30,8 @@
#include <gtk/gtkwindow.h>
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#include "send_message.h"
#include "session.h"
@@ -307,6 +309,7 @@ static gint send_message_local(const gchar *command, FILE *fp)
gint child_stdin;
gchar buf[BUFFSIZE];
gboolean err = FALSE;
+ gint status;
g_return_val_if_fail(command != NULL, -1);
g_return_val_if_fail(fp != NULL, -1);
@@ -315,8 +318,10 @@ static gint send_message_local(const gchar *command, FILE *fp)
argv = strsplit_with_quote(command, " ", 0);
- if (g_spawn_async_with_pipes(NULL, argv, NULL, 0, NULL, NULL, &pid,
- &child_stdin, NULL, NULL, NULL) == FALSE) {
+ if (g_spawn_async_with_pipes(NULL, argv, NULL,
+ G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL,
+ &pid, &child_stdin, NULL, NULL,
+ NULL) == FALSE) {
g_snprintf(buf, sizeof(buf),
_("Can't execute command: %s"), command);
log_warning("%s\n", buf);
@@ -342,6 +347,11 @@ static gint send_message_local(const gchar *command, FILE *fp)
}
fd_close(child_stdin);
+
+ waitpid(pid, &status, 0);
+ if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+ err = TRUE;
+
g_spawn_close_pid(pid);
if (err) {