/[mailutils]/mailutils/mailbox/mbx_default.c
ViewVC logotype

Diff of /mailutils/mailbox/mbx_default.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by sroberts, Mon Mar 25 03:46:11 2002 UTC revision 1.22 by gray, Thu Mar 28 12:46:18 2002 UTC
# Line 33  Line 33 
33  #include <mailutils/mailbox.h>  #include <mailutils/mailbox.h>
34  #include <mailutils/mutil.h>  #include <mailutils/mutil.h>
35  #include <mailutils/error.h>  #include <mailutils/error.h>
36    #include <mailutils/errno.h>
37    
38  const char *mu_path_maildir = MU_PATH_MAILDIR;  const char *mu_path_maildir = MU_PATH_MAILDIR;
39    
# Line 58  split_shortcut (const char *file, const Line 59  split_shortcut (const char *file, const
59          len = p - file + 1;          len = p - file + 1;
60        else        else
61          len = strlen (file) + 1;          len = strlen (file) + 1;
         
       *user = calloc (1, len);  
       if (!*user)  
         return ENOMEM;  
62    
63        memcpy (*user, file, len);        if (len == 1)
64        (*user)[len-1] = 0;          *user = NULL;
65          else
66            {
67              *user = calloc (1, len);
68              if (!*user)
69                return ENOMEM;
70    
71              memcpy (*user, file, len);
72              (*user)[len-1] = 0;
73            }
74        file += len-1;        file += len-1;
75        if (file[0] == '/')        if (file[0] == '/')
76          file++;          file++;
# Line 189  tilde_expand (const char *file, char **b Line 195  tilde_expand (const char *file, char **b
195    if ((status = split_shortcut (file, "~", &user, &path)))    if ((status = split_shortcut (file, "~", &user, &path)))
196      return status;      return status;
197    
   if (!user)  
     return ENOENT;  
198    if (!path)    if (!path)
199      {      {
200        free (user);        if (user)
201            free (user);
202        return ENOENT;        return ENOENT;
203      }      }
204        
# Line 202  tilde_expand (const char *file, char **b Line 207  tilde_expand (const char *file, char **b
207      {      {
208        free (user);        free (user);
209        free (path);        free (path);
210        return ENOENT;        return MU_ERR_NO_SUCH_USER;
211      }      }
212    
213    free (user); /* not needed anymore */    free (user); /* not needed anymore */

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26