~ubuntu-branches/ubuntu/precise/rpm/precise-proposed

« back to all changes in this revision

Viewing changes to build/parseReqs.c

  • Committer: Bazaar Package Importer
  • Author(s): Michal Čihař
  • Date: 2010-06-28 11:12:30 UTC
  • mfrom: (17.2.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100628111230-8ggjjhgpvrnr3ybx
Tags: 4.8.1-5
Fix compilation on hurd and kfreebsd (Closes: #587366).

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
               int index, rpmsenseFlags tagflags)
38
38
{
39
39
    const char *r, *re, *v, *ve;
40
 
    char * N, * EVR;
 
40
    char * N = NULL, * EVR = NULL;
41
41
    rpmsenseFlags Flags;
42
42
    Header h;
 
43
    rpmRC rc = RPMRC_FAIL; /* assume failure */
43
44
 
44
45
    switch (tagN) {
45
46
    case RPMTAG_PROVIDEFLAGS:
106
107
            rpmlog(RPMLOG_ERR,
107
108
                     _("line %d: Dependency tokens must begin with alpha-numeric, '_' or '/': %s\n"),
108
109
                     spec->lineNum, spec->line);
109
 
            return RPMRC_FAIL;
 
110
            goto exit;
110
111
        }
111
112
 
112
113
        re = r;
126
127
        if (ve > v) {
127
128
          const struct ReqComp *rc;
128
129
          for (rc = ReqComparisons; rc->token != NULL; rc++) {
129
 
            if ((ve-v) != strlen(rc->token) || strncmp(v, rc->token, (ve-v)))
 
130
            if ((ve-v) != strlen(rc->token) || !rstreqn(v, rc->token, (ve-v)))
130
131
                continue;
131
132
 
132
133
            if (r[0] == '/') {
133
134
                rpmlog(RPMLOG_ERR,
134
135
                         _("line %d: Versioned file name not permitted: %s\n"),
135
136
                         spec->lineNum, spec->line);
136
 
                return RPMRC_FAIL;
 
137
                goto exit;
137
138
            }
138
139
 
139
140
            switch(tagN) {
163
164
            if (*v == '\0' || ve == v) {
164
165
                rpmlog(RPMLOG_ERR, _("line %d: Version required: %s\n"),
165
166
                        spec->lineNum, spec->line);
166
 
                return RPMRC_FAIL;
 
167
                goto exit;
167
168
            }
168
169
            EVR = xmalloc((ve-v) + 1);
169
170
            rstrlcpy(EVR, v, (ve-v) + 1);
 
171
            if (rpmCharCheck(spec, EVR, ve-v, ".-_+:%{}")) goto exit;
170
172
            re = ve;    /* ==> next token after EVR string starts here */
171
173
        } else
172
174
            EVR = NULL;
173
175
 
174
 
        (void) addReqProv(spec, h, tagN, N, EVR, Flags, index);
 
176
        if (addReqProv(spec, h, tagN, N, EVR, Flags, index)) {
 
177
            rpmlog(RPMLOG_ERR, _("line %d: invalid dependency: %s\n"),
 
178
                   spec->lineNum, spec->line);
 
179
            goto exit;
 
180
        }
175
181
 
176
182
        N = _free(N);
177
183
        EVR = _free(EVR);
178
184
 
179
185
    }
180
 
 
181
 
    return RPMRC_OK;
 
186
    rc = RPMRC_OK;
 
187
 
 
188
exit:
 
189
    free(N);
 
190
    free(EVR);
 
191
 
 
192
    return rc;
182
193
}