Skip to content

Commit

Permalink
alternatives setService(): Add missing error mesg
Browse files Browse the repository at this point in the history
You will get this mesg when trying to do:
\# alternatives --set python /usr/bin/python2
When there is no python2, you'll get error 2 plus error mesg added by
this patch

Resolves: #1820089
  • Loading branch information
jamacku committed Apr 6, 2020
1 parent 5ff6905 commit e53780f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions alternatives.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,10 +1069,16 @@ static int setService(const char *title, const char *target, const char *altDir,
const char *stateDir, int flags) {
struct alternativeSet set;
int found = -1;
int i;
int i, r;

if (readConfig(&set, title, altDir, stateDir, flags))
r = readConfig(&set, title, altDir, stateDir, flags);
if (r) {
if (r == 3) {
fprintf(stderr,
_("cannot access %s/%s: No such file or directory\n"), stateDir, title);
}
return 2;
}

for (i = 0; i < set.numAlts; i++)
if (!strcmp(set.alts[i].master.target, target)) {
Expand Down

0 comments on commit e53780f

Please sign in to comment.