always show the input path when realpath(3) returns an error
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
diff --git a/got/got.c b/got/got.c
index 4e4e359..5639241 100644
--- a/got/got.c
+++ b/got/got.c
@@ -601,7 +601,8 @@ cmd_import(int argc, char *argv[])
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL) {
- error = got_error_from_errno("realpath");
+ error = got_error_from_errno2("realpath",
+ optarg);
goto done;
}
break;
@@ -665,7 +666,7 @@ cmd_import(int argc, char *argv[])
path_dir = realpath(argv[0], NULL);
if (path_dir == NULL) {
- error = got_error_from_errno("realpath");
+ error = got_error_from_errno2("realpath", argv[0]);
goto done;
}
got_path_strip_trailing_slashes(path_dir);
@@ -1819,7 +1820,8 @@ cmd_log(int argc, char *argv[])
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
- err(1, "-r option");
+ return got_error_from_errno2("realpath",
+ optarg);
got_path_strip_trailing_slashes(repo_path);
break;
default:
@@ -2203,7 +2205,8 @@ cmd_diff(int argc, char *argv[])
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
- err(1, "-r option");
+ return got_error_from_errno2("realpath",
+ optarg);
got_path_strip_trailing_slashes(repo_path);
break;
case 's':
@@ -2531,7 +2534,8 @@ cmd_blame(int argc, char *argv[])
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
- err(1, "-r option");
+ return got_error_from_errno2("realpath",
+ optarg);
got_path_strip_trailing_slashes(repo_path);
break;
default:
@@ -2824,7 +2828,8 @@ cmd_tree(int argc, char *argv[])
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
- err(1, "-r option");
+ return got_error_from_errno2("realpath",
+ optarg);
got_path_strip_trailing_slashes(repo_path);
break;
case 'i':
@@ -3164,7 +3169,8 @@ cmd_ref(int argc, char *argv[])
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
- err(1, "-r option");
+ return got_error_from_errno2("realpath",
+ optarg);
got_path_strip_trailing_slashes(repo_path);
break;
case 'l':
@@ -3469,7 +3475,8 @@ cmd_branch(int argc, char *argv[])
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
- err(1, "-r option");
+ return got_error_from_errno2("realpath",
+ optarg);
got_path_strip_trailing_slashes(repo_path);
break;
case 'l':
@@ -3947,7 +3954,8 @@ cmd_tag(int argc, char *argv[])
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
- err(1, "-r option");
+ return got_error_from_errno2("realpath",
+ optarg);
got_path_strip_trailing_slashes(repo_path);
break;
case 'l':
@@ -7076,7 +7084,8 @@ cmd_cat(int argc, char *argv[])
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
- err(1, "-r option");
+ return got_error_from_errno2("realpath",
+ optarg);
got_path_strip_trailing_slashes(repo_path);
break;
case 'P':
diff --git a/tog/tog.c b/tog/tog.c
index a83600d..07efa35 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -2278,7 +2278,8 @@ cmd_log(int argc, char *argv[])
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
- err(1, "-r option");
+ return got_error_from_errno2("realpath",
+ optarg);
break;
default:
usage_log();
@@ -3824,7 +3825,8 @@ cmd_blame(int argc, char *argv[])
case 'r':
repo_path = realpath(optarg, NULL);
if (repo_path == NULL)
- err(1, "-r option");
+ return got_error_from_errno2("realpath",
+ optarg);
break;
default:
usage_blame();