mirror of
https://github.com/jarun/nnn.git
synced 2025-01-15 21:36:42 +00:00
Show errno on link creation failure
This commit is contained in:
parent
2e84716e76
commit
824e7a2c18
10
src/nnn.c
10
src/nnn.c
|
@ -3698,7 +3698,7 @@ static char *getreadline(const char *prompt)
|
||||||
* Create symbolic/hard link(s) to file(s) in selection list
|
* Create symbolic/hard link(s) to file(s) in selection list
|
||||||
* Returns the number of links created, -1 on error
|
* Returns the number of links created, -1 on error
|
||||||
*/
|
*/
|
||||||
static int xlink(char *prefix, char *path, char *curfname, char *buf, int *presel, int type)
|
static int xlink(char *prefix, char *path, char *curfname, char *buf, int type)
|
||||||
{
|
{
|
||||||
int count = 0, choice;
|
int count = 0, choice;
|
||||||
char *psel = pselbuf, *fname;
|
char *psel = pselbuf, *fname;
|
||||||
|
@ -3725,8 +3725,7 @@ static int xlink(char *prefix, char *path, char *curfname, char *buf, int *prese
|
||||||
return 1; /* One link created */
|
return 1; /* One link created */
|
||||||
}
|
}
|
||||||
|
|
||||||
printwarn(presel);
|
return 0;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (pos < selbufpos) {
|
while (pos < selbufpos) {
|
||||||
|
@ -7710,12 +7709,11 @@ nochange:
|
||||||
} else if (r == 's' || r == 'h') {
|
} else if (r == 's' || r == 'h') {
|
||||||
if (nselected > 1 && tmp[0] == '@' && tmp[1] == '\0')
|
if (nselected > 1 && tmp[0] == '@' && tmp[1] == '\0')
|
||||||
tmp[0] = '\0';
|
tmp[0] = '\0';
|
||||||
ret = xlink(tmp, path, (ndents ? pdents[cur].name : NULL),
|
ret = xlink(tmp, path, (ndents ? pdents[cur].name : NULL), newpath, r);
|
||||||
newpath, &presel, r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
printwait(messages[MSG_FAILED], &presel);
|
printwarn(&presel);
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
goto nochange;
|
goto nochange;
|
||||||
|
|
Loading…
Reference in a new issue