(list_copy): Do nothing if src is NULL.
(imap_list): Use mu_argcv_get instead of strtok_r to parse last two tokens of the reply, so that file names containing white space are processed.
Showing
1 changed file
with
19 additions
and
8 deletions
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001, 2003, 2004, | 2 | Copyright (C) 1999, 2000, 2001, 2003, 2004, |
3 | 2005 Free Software Foundation, Inc. | 3 | 2005, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -830,6 +830,9 @@ list_copy (mu_list_t dst, mu_list_t src, | ... | @@ -830,6 +830,9 @@ list_copy (mu_list_t dst, mu_list_t src, |
830 | { | 830 | { |
831 | mu_iterator_t itr; | 831 | mu_iterator_t itr; |
832 | 832 | ||
833 | if (!src) | ||
834 | return; | ||
835 | |||
833 | mu_list_get_iterator (src, &itr); | 836 | mu_list_get_iterator (src, &itr); |
834 | for (mu_iterator_first (itr); !mu_iterator_is_done (itr); | 837 | for (mu_iterator_first (itr); !mu_iterator_is_done (itr); |
835 | mu_iterator_next (itr)) | 838 | mu_iterator_next (itr)) |
... | @@ -1325,6 +1328,8 @@ imap_list (f_imap_t f_imap) | ... | @@ -1325,6 +1328,8 @@ imap_list (f_imap_t f_imap) |
1325 | char *buffer; | 1328 | char *buffer; |
1326 | struct mu_list_response *lr; | 1329 | struct mu_list_response *lr; |
1327 | int status = 0; | 1330 | int status = 0; |
1331 | int argc; | ||
1332 | char **argv; | ||
1328 | 1333 | ||
1329 | buffer = alloca (len); | 1334 | buffer = alloca (len); |
1330 | memcpy (buffer, f_imap->buffer, len); | 1335 | memcpy (buffer, f_imap->buffer, len); |
... | @@ -1365,15 +1370,19 @@ imap_list (f_imap_t f_imap) | ... | @@ -1365,15 +1370,19 @@ imap_list (f_imap_t f_imap) |
1365 | p = NULL; | 1370 | p = NULL; |
1366 | } | 1371 | } |
1367 | } | 1372 | } |
1373 | |||
1374 | status = mu_argcv_get (sp, "", NULL, &argc, &argv); | ||
1375 | if (status == 0) | ||
1376 | { | ||
1377 | char *s; | ||
1378 | |||
1368 | /* Hiearchy delimeter. */ | 1379 | /* Hiearchy delimeter. */ |
1369 | tok = strtok_r (NULL, " ", &sp); | 1380 | tok = argv[0]; |
1370 | if (tok && strlen (tok) > 2 && strcasecmp (tok, "NIL")) | 1381 | if (tok && tok[1] == 0 && strcasecmp (tok, "NIL")) |
1371 | lr->separator = tok[1]; | 1382 | lr->separator = tok[0]; |
1372 | /* The path. */ | 1383 | /* The path. */ |
1373 | tok = strtok_r (NULL, " ", &sp); | 1384 | tok = argv[1]; |
1374 | if (tok) | 1385 | s = strchr (tok, '{'); |
1375 | { | ||
1376 | char *s = strchr (tok, '{'); | ||
1377 | if (s) | 1386 | if (s) |
1378 | { | 1387 | { |
1379 | size_t n = strtoul (s + 1, NULL, 10); | 1388 | size_t n = strtoul (s + 1, NULL, 10); |
... | @@ -1408,6 +1417,8 @@ imap_list (f_imap_t f_imap) | ... | @@ -1408,6 +1417,8 @@ imap_list (f_imap_t f_imap) |
1408 | status = ENOMEM; | 1417 | status = ENOMEM; |
1409 | } | 1418 | } |
1410 | } | 1419 | } |
1420 | mu_argcv_free (argc, argv); | ||
1421 | |||
1411 | return status; | 1422 | return status; |
1412 | } | 1423 | } |
1413 | 1424 | ... | ... |
-
Please register or sign in to post a comment