summaryrefslogtreecommitdiff
path: root/imap/src
diff options
context:
space:
mode:
Diffstat (limited to 'imap/src')
-rw-r--r--imap/src/osdep/unix/mbx.c9
-rw-r--r--imap/src/osdep/unix/mh.c10
-rw-r--r--imap/src/osdep/unix/mix.c22
-rw-r--r--imap/src/osdep/unix/mx.c10
-rw-r--r--imap/src/osdep/unix/news.c10
5 files changed, 33 insertions, 28 deletions
diff --git a/imap/src/osdep/unix/mbx.c b/imap/src/osdep/unix/mbx.c
index ddb8ae89..3770e0a9 100644
--- a/imap/src/osdep/unix/mbx.c
+++ b/imap/src/osdep/unix/mbx.c
@@ -1512,10 +1512,12 @@ unsigned long mbx_read_flags (MAILSTREAM *stream,MESSAGECACHE *elt)
fatal (LOCAL->buf);
}
if ((LOCAL->buf[0] != ';') || (LOCAL->buf[13] != '-')) {
+ char tmp[16];
LOCAL->buf[14] = '\0'; /* tie off buffer for error message */
+ strncpy(tmp, LOCAL->buf, 14);
sprintf (LOCAL->buf+50,"Invalid flags for message %lu (%lu %lu): %s",
elt->msgno,elt->private.special.offset,
- elt->private.special.text.size,(char *) LOCAL->buf);
+ elt->private.special.text.size,(char *) tmp);
fatal (LOCAL->buf+50);
}
LOCAL->buf[13] = '\0'; /* tie off buffer */
@@ -1596,10 +1598,13 @@ void mbx_update_status (MAILSTREAM *stream,unsigned long msgno,long flags)
fatal (LOCAL->buf);
}
if ((LOCAL->buf[0] != ';') || (LOCAL->buf[13] != '-')) {
+ char tmp[16];
+ LOCAL->buf[14] = '\0'; /* tie off buffer for error message */
+ strncpy(tmp, LOCAL->buf, 14);
LOCAL->buf[14] = '\0'; /* tie off buffer for error message */
sprintf (LOCAL->buf+50,"Invalid flags for message %lu (%lu %lu): %s",
elt->msgno,elt->private.special.offset,
- elt->private.special.text.size,(char *) LOCAL->buf);
+ elt->private.special.text.size,(char *) tmp);
fatal (LOCAL->buf+50);
}
/* print new flag string */
diff --git a/imap/src/osdep/unix/mh.c b/imap/src/osdep/unix/mh.c
index ab4449f4..68e3aa68 100644
--- a/imap/src/osdep/unix/mh.c
+++ b/imap/src/osdep/unix/mh.c
@@ -100,8 +100,8 @@ long mh_copy (MAILSTREAM *stream,char *sequence,char *mailbox,
long options);
long mh_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data);
-int mh_select (struct direct *name);
-int mh_numsort (const void *d1,const void *d2);
+int mh_select (const struct direct *name);
+int mh_numsort (const struct direct **d1,const struct direct **d2);
char *mh_file (char *dst,char *name);
long mh_canonicalize (char *pattern,char *ref,char *pat);
void mh_setdate (char *file,MESSAGECACHE *elt);
@@ -1192,10 +1192,10 @@ long mh_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data)
* Returns: T to use file name, NIL to skip it
*/
-int mh_select (struct direct *name)
+int mh_select (const struct direct *name)
{
char c;
- char *s = name->d_name;
+ char *s = (char *) name->d_name;
while ((c = *s++) != '\0') if (!isdigit (c)) return NIL;
return T;
}
@@ -1207,7 +1207,7 @@ int mh_select (struct direct *name)
* Returns: negative if d1 < d2, 0 if d1 == d2, positive if d1 > d2
*/
-int mh_numsort (const void *d1,const void *d2)
+int mh_numsort (const struct direct **d1,const struct direct **d2)
{
return atoi ((*(struct direct **) d1)->d_name) -
atoi ((*(struct direct **) d2)->d_name);
diff --git a/imap/src/osdep/unix/mix.c b/imap/src/osdep/unix/mix.c
index d2b5c71b..11b4b3a3 100644
--- a/imap/src/osdep/unix/mix.c
+++ b/imap/src/osdep/unix/mix.c
@@ -123,7 +123,7 @@ long mix_unsubscribe (MAILSTREAM *stream,char *mailbox);
long mix_create (MAILSTREAM *stream,char *mailbox);
long mix_delete (MAILSTREAM *stream,char *mailbox);
long mix_rename (MAILSTREAM *stream,char *old,char *newname);
-int mix_rselect (struct direct *name);
+int mix_rselect (const struct direct *name);
MAILSTREAM *mix_open (MAILSTREAM *stream);
void mix_close (MAILSTREAM *stream,long options);
void mix_abort (MAILSTREAM *stream);
@@ -138,8 +138,8 @@ THREADNODE *mix_thread (MAILSTREAM *stream,char *type,char *charset,
long mix_ping (MAILSTREAM *stream);
void mix_check (MAILSTREAM *stream);
long mix_expunge (MAILSTREAM *stream,char *sequence,long options);
-int mix_select (struct direct *name);
-int mix_msgfsort (const void *d1,const void *d2);
+int mix_select (const struct direct *name);
+int mix_msgfsort (const struct direct **d1,const struct direct **d2);
long mix_addset (SEARCHSET **set,unsigned long start,unsigned long size);
long mix_burp (MAILSTREAM *stream,MIXBURP *burp,unsigned long *reclaimed);
long mix_burp_check (SEARCHSET *set,size_t size,char *file);
@@ -586,9 +586,9 @@ long mix_rename (MAILSTREAM *stream,char *old,char *newname)
* Returns: T if mix file name, NIL otherwise
*/
-int mix_rselect (struct direct *name)
+int mix_rselect (const struct direct *name)
{
- return mix_dirfmttest (name->d_name);
+ return mix_dirfmttest ((char *) name->d_name);
}
/* MIX mail open
@@ -1151,12 +1151,12 @@ long mix_expunge (MAILSTREAM *stream,char *sequence,long options)
* ".mix" with no suffix was used by experimental versions
*/
-int mix_select (struct direct *name)
+int mix_select (const struct direct *name)
{
char c,*s;
/* make sure name has prefix */
- if (mix_dirfmttest (name->d_name)) {
- for (c = *(s = name->d_name + sizeof (MIXNAME) - 1); c && isxdigit (c);
+ if (mix_dirfmttest ((char *) name->d_name)) {
+ for (c = *(s = ((char *) name->d_name) + sizeof (MIXNAME) - 1); c && isxdigit (c);
c = *s++);
if (!c) return T; /* all-hex or no suffix */
}
@@ -1170,7 +1170,7 @@ int mix_select (struct direct *name)
* Returns: -1 if d1 < d2, 0 if d1 == d2, 1 d1 > d2
*/
-int mix_msgfsort (const void *d1,const void *d2)
+int mix_msgfsort (const struct direct **d1,const struct direct **d2)
{
char *n1 = (*(struct direct **) d1)->d_name + sizeof (MIXNAME) - 1;
char *n2 = (*(struct direct **) d2)->d_name + sizeof (MIXNAME) - 1;
@@ -2469,7 +2469,7 @@ FILE *mix_data_open (MAILSTREAM *stream,int *fd,long *size,
FILE *mix_sortcache_open (MAILSTREAM *stream)
{
- int fd,refwd;
+ int fd = -1,refwd;
unsigned long i,uid,sentdate,fromlen,tolen,cclen,subjlen,msgidlen,reflen;
char *s,*t,*msg,tmp[MAILTMPLEN];
MESSAGECACHE *elt;
@@ -2671,7 +2671,7 @@ FILE *mix_sortcache_open (MAILSTREAM *stream)
fclose (srtcf); /* so close it and return as if error */
srtcf = NIL;
}
- else fchmod (fd,sbuf.st_mode);
+ else if(fd >= 0) fchmod (fd,sbuf.st_mode);
return srtcf;
}
diff --git a/imap/src/osdep/unix/mx.c b/imap/src/osdep/unix/mx.c
index 54ea6ecb..6ba04ca0 100644
--- a/imap/src/osdep/unix/mx.c
+++ b/imap/src/osdep/unix/mx.c
@@ -98,8 +98,8 @@ long mx_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data);
long mx_append_msg (MAILSTREAM *stream,char *flags,MESSAGECACHE *elt,
STRING *st,SEARCHSET *set);
-int mx_select (struct direct *name);
-int mx_numsort (const void *d1,const void *d2);
+int mx_select (const struct direct *name);
+int mx_numsort (const struct direct **d1,const struct direct **d2);
char *mx_file (char *dst,char *name);
long mx_lockindex (MAILSTREAM *stream);
void mx_unlockindex (MAILSTREAM *stream);
@@ -1111,10 +1111,10 @@ long mx_append_msg (MAILSTREAM *stream,char *flags,MESSAGECACHE *elt,
* Returns: T to use file name, NIL to skip it
*/
-int mx_select (struct direct *name)
+int mx_select (const struct direct *name)
{
char c;
- char *s = name->d_name;
+ char *s = (char *) name->d_name;
while ((c = *s++) != '\0') if (!isdigit (c)) return NIL;
return T;
}
@@ -1126,7 +1126,7 @@ int mx_select (struct direct *name)
* Returns: negative if d1 < d2, 0 if d1 == d2, positive if d1 > d2
*/
-int mx_numsort (const void *d1,const void *d2)
+int mx_numsort (const struct direct **d1,const struct direct **d2)
{
return atoi ((*(struct direct **) d1)->d_name) -
atoi ((*(struct direct **) d2)->d_name);
diff --git a/imap/src/osdep/unix/news.c b/imap/src/osdep/unix/news.c
index d80ef003..beda8a66 100644
--- a/imap/src/osdep/unix/news.c
+++ b/imap/src/osdep/unix/news.c
@@ -76,8 +76,8 @@ long news_create (MAILSTREAM *stream,char *mailbox);
long news_delete (MAILSTREAM *stream,char *mailbox);
long news_rename (MAILSTREAM *stream,char *old,char *newname);
MAILSTREAM *news_open (MAILSTREAM *stream);
-int news_select (struct direct *name);
-int news_numsort (const void *d1,const void *d2);
+int news_select (const struct direct *name);
+int news_numsort (const struct direct **d1,const struct direct **d2);
void news_close (MAILSTREAM *stream,long options);
void news_fast (MAILSTREAM *stream,char *sequence,long flags);
void news_flags (MAILSTREAM *stream,char *sequence,long flags);
@@ -403,10 +403,10 @@ MAILSTREAM *news_open (MAILSTREAM *stream)
* Returns: T to use file name, NIL to skip it
*/
-int news_select (struct direct *name)
+int news_select (const struct direct *name)
{
char c;
- char *s = name->d_name;
+ char *s = (char *) name->d_name;
while ((c = *s++) != '\0') if (!isdigit (c)) return NIL;
return T;
}
@@ -418,7 +418,7 @@ int news_select (struct direct *name)
* Returns: negative if d1 < d2, 0 if d1 == d2, positive if d1 > d2
*/
-int news_numsort (const void *d1,const void *d2)
+int news_numsort (const struct direct **d1,const struct direct **d2)
{
return atoi ((*(struct direct **) d1)->d_name) -
atoi ((*(struct direct **) d2)->d_name);