mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-23 10:04:00 +08:00
Fixed reporting an error when failed to build the mountpoint
The size check was inefficient because getcwd() uses an unsigned int argument.
This commit is contained in:
parent
f424cea20a
commit
85c1634a26
@ -4411,7 +4411,8 @@ int main(int argc, char *argv[])
|
|||||||
else {
|
else {
|
||||||
ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX);
|
ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX);
|
||||||
if (ctx->abs_mnt_point) {
|
if (ctx->abs_mnt_point) {
|
||||||
if (getcwd(ctx->abs_mnt_point,
|
if ((strlen(opts.mnt_point) < PATH_MAX)
|
||||||
|
&& getcwd(ctx->abs_mnt_point,
|
||||||
PATH_MAX - strlen(opts.mnt_point) - 1)) {
|
PATH_MAX - strlen(opts.mnt_point) - 1)) {
|
||||||
strcat(ctx->abs_mnt_point, "/");
|
strcat(ctx->abs_mnt_point, "/");
|
||||||
strcat(ctx->abs_mnt_point, opts.mnt_point);
|
strcat(ctx->abs_mnt_point, opts.mnt_point);
|
||||||
@ -4419,6 +4420,9 @@ int main(int argc, char *argv[])
|
|||||||
/* Solaris also wants the absolute mount point */
|
/* Solaris also wants the absolute mount point */
|
||||||
opts.mnt_point = ctx->abs_mnt_point;
|
opts.mnt_point = ctx->abs_mnt_point;
|
||||||
#endif /* defined(__sun) && defined (__SVR4) */
|
#endif /* defined(__sun) && defined (__SVR4) */
|
||||||
|
} else {
|
||||||
|
free(ctx->abs_mnt_point);
|
||||||
|
ctx->abs_mnt_point = (char*)NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4148,7 +4148,8 @@ int main(int argc, char *argv[])
|
|||||||
else {
|
else {
|
||||||
ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX);
|
ctx->abs_mnt_point = (char*)ntfs_malloc(PATH_MAX);
|
||||||
if (ctx->abs_mnt_point) {
|
if (ctx->abs_mnt_point) {
|
||||||
if (getcwd(ctx->abs_mnt_point,
|
if ((strlen(opts.mnt_point) < PATH_MAX)
|
||||||
|
&& getcwd(ctx->abs_mnt_point,
|
||||||
PATH_MAX - strlen(opts.mnt_point) - 1)) {
|
PATH_MAX - strlen(opts.mnt_point) - 1)) {
|
||||||
strcat(ctx->abs_mnt_point, "/");
|
strcat(ctx->abs_mnt_point, "/");
|
||||||
strcat(ctx->abs_mnt_point, opts.mnt_point);
|
strcat(ctx->abs_mnt_point, opts.mnt_point);
|
||||||
@ -4156,6 +4157,9 @@ int main(int argc, char *argv[])
|
|||||||
/* Solaris also wants the absolute mount point */
|
/* Solaris also wants the absolute mount point */
|
||||||
opts.mnt_point = ctx->abs_mnt_point;
|
opts.mnt_point = ctx->abs_mnt_point;
|
||||||
#endif /* defined(__sun) && defined (__SVR4) */
|
#endif /* defined(__sun) && defined (__SVR4) */
|
||||||
|
} else {
|
||||||
|
free(ctx->abs_mnt_point);
|
||||||
|
ctx->abs_mnt_point = (char*)NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user