~ubuntu-branches/ubuntu/trusty/argyll/trusty-proposed

« back to all changes in this revision

Viewing changes to spectro/aglob.c

  • Committer: Package Import Robot
  • Author(s): Artur Rona
  • Date: 2014-02-12 00:35:39 UTC
  • mfrom: (13.1.24 sid)
  • Revision ID: package-import@ubuntu.com-20140212003539-24tautzlitsiz61w
Tags: 1.5.1-5ubuntu1
* Merge from Debian unstable. (LP: #1275572) Remaining changes:
  - debian/control:
    + Build-depend on libtiff-dev rather than libtiff4-dev.
  - debian/control, debian/patches/06_fix_udev_rule.patch:
    + Fix udev rules to actually work; ENV{ACL_MANAGE} has
      stopped working ages ago, and with logind it's now the
      "uaccess" tag. Dropping also consolekit from Recommends.
  - debian/patches/drop-usb-db.patch:
    + Use hwdb builtin, instead of the obsolete usb-db
      in the udev rules.
* debian/patches/05_ftbfs-underlinkage.diff:
  - Dropped change, no needed anymore.
* Refresh the patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
# include <io.h>
37
37
#endif
38
38
 
39
 
#if defined (UNIX) || defined(__APPLE__)
 
39
#if defined (UNIX)
40
40
# include <unistd.h>
41
41
# include <glob.h>
42
42
# include <pthread.h>
50
50
#include <string.h>
51
51
#include <time.h>
52
52
 
 
53
#include "numsup.h"
53
54
#include "aglob.h"
54
55
 
55
56
/* Create the aglob */
65
66
        else
66
67
                rlen = pp - spath + 1;
67
68
 
68
 
        if ((g->base = malloc(rlen + 1)) == NULL)
 
69
        if ((g->base = malloc(rlen + 1)) == NULL) {
 
70
                a1loge(g_log, 1, "aglob_create: malloc failed\n");
69
71
                return 1;
 
72
        }
70
73
 
71
74
        memmove(g->base, spath, rlen);
72
75
        g->base[rlen] = '\000';
74
77
        g->first = 1;
75
78
    g->ff = _findfirst(spath, &g->ffs);
76
79
#else /* UNIX */
 
80
        memset(&g->g, 0, sizeof(g->g));
77
81
        g->rv = glob(spath, GLOB_NOSORT, NULL, &g->g);
78
 
        if (g->rv == GLOB_NOSPACE)
 
82
//a1loge(g_log, 0, "~1 glob '%s' returns %d and gl_pathc = %d\n",spath,g->rv,g->g.gl_pathc);
 
83
        if (g->rv == GLOB_NOSPACE) {
 
84
                a1loge(g_log, 1, "aglob_create: glob returned GLOB_NOSPACE\n");
79
85
                return 1;
 
86
        }
80
87
        g->ix = 0;
81
88
#endif
82
89
        g->merr = 0;
101
108
 
102
109
        /* Convert match filename to full path */
103
110
        if ((fpath = malloc(strlen(g->base) + strlen(g->ffs.name) + 1)) == NULL) {
 
111
                a1loge(g_log, 1, "aglob_next: malloc failed\n");
104
112
                g->merr = 1;
105
113
                return NULL;
106
114
        }
111
119
        if (g->rv != 0 || g->ix >= g->g.gl_pathc)
112
120
                return NULL;
113
121
        if ((fpath = strdup(g->g.gl_pathv[g->ix])) == NULL) {
 
122
                a1loge(g_log, 1, "aglob_next: strdup failed\n");
114
123
                g->merr = 1;
115
124
                return NULL;
116
125
        }