~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_tempdir.c

merged

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
22
22
{
23
 
  char *end, *copy;
 
23
  const char *end;
 
24
  char *copy;
24
25
  char buff[FN_REFLEN];
25
26
 
26
27
  pthread_mutex_init(&tmpdir->mutex, MY_MUTEX_INIT_FAST);
33
34
    if (!pathlist || !pathlist[0])
34
35
      pathlist=(char*) P_tmpdir;
35
36
  }
36
 
  while((end= strrchr(pathlist, DELIM)) != NULL)
37
 
  {
 
37
  do {
38
38
    uint length;
 
39
    end= strrchr(pathlist, DELIM);
 
40
    if (end == NULL)
 
41
      end= pathlist+strlen(pathlist);
39
42
    strmake(buff, pathlist, (uint) (end-pathlist));
40
43
    length= cleanup_dirname(buff, buff);
41
44
    if (!(copy= my_strndup(buff, length, MYF(MY_WME))) ||
42
45
        insert_dynamic(&tmpdir->full_list, (uchar*) &copy))
43
46
      return(true);
44
47
    pathlist=end+1;
45
 
  }
 
48
  } while (*end != '\0');
46
49
  freeze_size(&tmpdir->full_list);
47
50
  tmpdir->list=(char **)tmpdir->full_list.buffer;
48
51
  tmpdir->max=tmpdir->full_list.elements-1;