~xnox/ubuntu/saucy/lxc/dep8

« back to all changes in this revision

Viewing changes to src/lxc/parse.c

  • Committer: Stéphane Graber
  • Date: 2013-02-18 15:20:18 UTC
  • mto: This revision was merged to the branch mainline in revision 190.
  • Revision ID: stgraber@ubuntu.com-20130218152018-ls2gi9hkqs2kuhj8
Tags: upstream-0.9.0~alpha3
Import upstream version 0.9.0~alpha3

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <dirent.h>
30
30
 
31
31
#include "parse.h"
 
32
#include "config.h"
32
33
#include <lxc/log.h>
33
34
 
 
35
/* Define getline() if missing from the C library */
 
36
#ifndef HAVE_GETLINE
 
37
#ifdef HAVE_FGETLN
 
38
#include <../include/getline.h>
 
39
#endif
 
40
#endif
 
41
 
 
42
/* Workaround for the broken signature of alphasort() in bionic.
 
43
   This was fixed upstream in 40e467ec668b59be25491bd44bf348a884d6a68d so the
 
44
   workaround can probably be dropped with the next version of the Android NDK.
 
45
 */
 
46
#ifdef IS_BIONIC
 
47
int bionic_alphasort(const struct dirent** a, const struct dirent** b) {
 
48
       return strcoll((*a)->d_name, (*b)->d_name);
 
49
}
 
50
#endif
 
51
 
 
52
 
34
53
lxc_log_define(lxc_parse, lxc);
35
54
 
36
55
static int dir_filter(const struct dirent *dirent)
47
66
        struct dirent **namelist;
48
67
        int n, ret = 0;
49
68
 
 
69
#ifdef IS_BIONIC
 
70
        n = scandir(directory, &namelist, dir_filter, bionic_alphasort);
 
71
#else
50
72
        n = scandir(directory, &namelist, dir_filter, alphasort);
 
73
#endif
51
74
        if (n < 0) {
52
75
                SYSERROR("failed to scan %s directory", directory);
53
76
                return -1;