projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Here's a better test of Resent-From: in test-rcvdist: use the user's
[mmh]
/
sbr
/
folder_read.c
diff --git
a/sbr/folder_read.c
b/sbr/folder_read.c
index
b5b3f9d
..
2920448
100644
(file)
--- a/
sbr/folder_read.c
+++ b/
sbr/folder_read.c
@@
-2,14
+2,13
@@
/*
* folder_read.c -- initialize folder structure and read folder
*
/*
* folder_read.c -- initialize folder structure and read folder
*
- * $Id$
- *
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <h/mh.h>
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*/
#include <h/mh.h>
+#include <h/utils.h>
/* We allocate the `mi' array 1024 elements at a time */
#define NUMMSGS 1024
/* We allocate the `mi' array 1024 elements at a time */
#define NUMMSGS 1024
@@
-44,8
+43,7
@@
folder_read (char *name)
}
/* Allocate the main structure for folder information */
}
/* Allocate the main structure for folder information */
- if (!(mp = (struct msgs *) malloc ((size_t) sizeof(*mp))))
- adios (NULL, "unable to allocate folder storage");
+ mp = (struct msgs *) mh_xmalloc ((size_t) sizeof(*mp));
clear_folder_flags (mp);
mp->foldpath = name;
clear_folder_flags (mp);
mp->foldpath = name;
@@
-57,7
+55,7
@@
folder_read (char *name)
mp->numsel = 0;
mp->nummsg = 0;
mp->numsel = 0;
mp->nummsg = 0;
- if (access (name, W_OK) == -1 || st.st_uid != getuid())
+ if (access (name, W_OK) == -1)
set_readonly (mp);
prefix_len = strlen(BACKUP_PREFIX);
set_readonly (mp);
prefix_len = strlen(BACKUP_PREFIX);
@@
-66,21
+64,17
@@
folder_read (char *name)
* name of the messages in this folder.
*/
len = NUMMSGS;
* name of the messages in this folder.
*/
len = NUMMSGS;
- if (!(mi = (int *) malloc ((size_t) (len * sizeof(*mi)))))
- adios (NULL, "unable to allocate storage");
+ mi = (int *) mh_xmalloc ((size_t) (len * sizeof(*mi)));
while ((dp = readdir (dd))) {
while ((dp = readdir (dd))) {
- if ((msgnum = m_atoi (dp->d_name))) {
+ if ((msgnum = m_atoi (dp->d_name)) && msgnum > 0) {
/*
* Check if we need to allocate more
* temporary elements for message names.
*/
if (mp->nummsg >= len) {
len += NUMMSGS;
/*
* Check if we need to allocate more
* temporary elements for message names.
*/
if (mp->nummsg >= len) {
len += NUMMSGS;
- if (!(mi = (int *) realloc (mi,
- (size_t) (len * sizeof(*mi))))) {
- adios (NULL, "unable to allocate storage");
- }
+ mi = (int *) mh_xrealloc (mi, (size_t) (len * sizeof(*mi)));
}
/* Check if this is the first message we've seen */
}
/* Check if this is the first message we've seen */
@@
-105,9
+99,6
@@
folder_read (char *name)
switch (dp->d_name[0]) {
case '.':
case ',':
switch (dp->d_name[0]) {
case '.':
case ',':
-#ifdef MHE
- case '+':
-#endif /* MHE */
continue;
default:
continue;
default:
@@
-138,8
+129,7
@@
folder_read (char *name)
/*
* Allocate space for status of each message.
*/
/*
* Allocate space for status of each message.
*/
- if (!(mp->msgstats = malloc (MSGSTATSIZE(mp, mp->lowoff, mp->hghoff))))
- adios (NULL, "unable to allocate storage for msgstats");
+ mp->msgstats = mh_xmalloc (MSGSTATSIZE(mp, mp->lowoff, mp->hghoff));
/*
* Clear all the flag bits for all the message
/*
* Clear all the flag bits for all the message