aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-09-25 04:01:20 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-09-25 04:01:20 +0800
commit3a50fb41b5f51828b5a90243b7170d70e93292dd (patch)
tree7bca0549a387d8101df42509f3253397976a0190
parentfb1cdc02878ea1c6a37671fc326145f8a20ded81 (diff)
downloadgsoc2013-evolution-3a50fb41b5f51828b5a90243b7170d70e93292dd.tar.gz
gsoc2013-evolution-3a50fb41b5f51828b5a90243b7170d70e93292dd.tar.zst
gsoc2013-evolution-3a50fb41b5f51828b5a90243b7170d70e93292dd.zip
Updated to handle FIFO streams.
2000-09-24 Jeffrey Stedfast <fejj@helixcode.com> * e-msg-composer.c (get_signature): Updated to handle FIFO streams. svn path=/trunk/; revision=5563
-rw-r--r--composer/ChangeLog5
-rw-r--r--composer/e-msg-composer.c49
2 files changed, 23 insertions, 31 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index a95af0ebf8..4198280f79 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,8 @@
+2000-09-24 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * e-msg-composer.c (get_signature): Updated to handle FIFO
+ streams.
+
2000-09-19 Dan Winship <danw@helixcode.com>
* e-msg-composer.c (e_msg_composer_construct): Don't g_error out
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 799a4a3180..2e86bf85ed 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -313,50 +313,37 @@ build_message (EMsgComposer *composer)
static char *
get_signature (const char *sigfile)
{
- char *rawsig;
- static char *htmlsig = NULL;
- static time_t sigmodtime = -1;
- struct stat st;
- int fd;
-
+ GString *rawsig;
+ char buf[1024];
+ char *htmlsig = NULL;
+ int fd, n;
+
if (!sigfile || !*sigfile) {
return NULL;
}
-
- if (stat (sigfile, &st) == -1) {
- char *msg;
-
- msg = g_strdup_printf ("Could not open signature file %s:\n%s",
- sigfile, g_strerror (errno));
- gnome_error_dialog (msg);
- g_free (msg);
-
- return NULL;
- }
-
- if (st.st_mtime == sigmodtime)
- return htmlsig;
-
- rawsig = g_malloc (st.st_size + 1);
+
fd = open (sigfile, O_RDONLY);
if (fd == -1) {
char *msg;
-
+
msg = g_strdup_printf ("Could not open signature file %s:\n%s",
sigfile, g_strerror (errno));
gnome_error_dialog (msg);
g_free (msg);
-
+
return NULL;
}
-
- read (fd, rawsig, st.st_size);
- rawsig[st.st_size] = '\0';
+
+ rawsig = g_string_new ("");
+ while ((n = read (fd, buf, 1023)) > 0) {
+ buf[n] = '\0';
+ g_string_append (rawsig, buf);
+ }
close (fd);
-
- htmlsig = e_text_to_html (rawsig, 0);
- sigmodtime = st.st_mtime;
-
+
+ htmlsig = e_text_to_html (rawsig->str, 0);
+ g_string_free (rawsig, TRUE);
+
return htmlsig;
}