]> code.citadel.org Git - citadel.git/blobdiff - citadel/room_ops.c
fix dnamlen, they missed the e, so we need to follow.
[citadel.git] / citadel / room_ops.c
index 14ddd8e53c154dc058222343b4367d59bf585e81..5a4d5503d05bb9315c61b3d9021c440e87b2fabf 100644 (file)
@@ -278,12 +278,13 @@ void room_sanity_check(struct ctdlroom *qrbuf)
 /*
  * CtdlGetRoom()  -  retrieve room data from disk
  */
-int CtdlGetRoom(struct ctdlroom *qrbuf, char *room_name)
+int CtdlGetRoom(struct ctdlroom *qrbuf, const char *room_name)
 {
        struct cdbdata *cdbqr;
        char lowercase_name[ROOMNAMELEN];
        char personal_lowercase_name[ROOMNAMELEN];
-       char *dptr, *sptr, *eptr;
+       const char *sptr;
+       char *dptr, *eptr;
 
        dptr = lowercase_name;
        sptr = room_name;
@@ -658,6 +659,7 @@ int sort_msglist_cmp(const void *m1, const void *m2) {
 int sort_msglist(long listptrs[], int oldcount)
 {
        int numitems;
+       int i = 0;
 
        numitems = oldcount;
        if (numitems < 2) {
@@ -668,9 +670,12 @@ int sort_msglist(long listptrs[], int oldcount)
        qsort(listptrs, numitems, sizeof(long), sort_msglist_cmp);
 
        /* and yank any nulls */
-       while ((numitems > 0) && (listptrs[0] == 0L)) {
-               memmove(&listptrs[0], &listptrs[1], (sizeof(long) * (numitems - 1)));
-               --numitems;
+       while ((i < numitems) && (listptrs[i] == 0L)) i++;
+
+       if (i > 0)
+       {
+               memmove(&listptrs[0], &listptrs[i], (sizeof(long) * (numitems - i)));
+               numitems-=i;
        }
 
        return (numitems);
@@ -1296,7 +1301,7 @@ void cmd_rdir(char *cmdbuf)
                if (strcasecmp(filedir_entry->d_name, "filedir") && filedir_entry->d_name[0] != '.')
                {
 #ifdef _DIRENT_HAVE_D_NAMELEN
-                       d_namelen = filedir_entry->d_namelen;
+                       d_namelen = filedir_entry->d_namlen;
 #else
                        d_namelen = strlen(filedir_entry->d_name);
 #endif
@@ -1703,7 +1708,7 @@ void cmd_seta(char *new_ra)
  */
 void cmd_rinf(char *gargs)
 {
-       char filename[128];
+       char filename[PATH_MAX];
        char buf[SIZ];
        FILE *info_fp;