summaryrefslogtreecommitdiffstats
path: root/winsup/utils/regtool.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/utils/regtool.cc')
-rw-r--r--winsup/utils/regtool.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc
index 6da9845f9..4bda9e646 100644
--- a/winsup/utils/regtool.cc
+++ b/winsup/utils/regtool.cc
@@ -414,8 +414,11 @@ find_key (int howmanyparts, REGSAM access, int option = 0)
}
else if (argv[1])
{
- char win32_path[MAX_PATH];
- cygwin_conv_to_win32_path (argv[1], win32_path);
+ ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE,
+ argv[1], NULL, 0);
+ char win32_path[len];
+ cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE, argv[1],
+ win32_path, len);
rv = RegLoadKey (base, n, win32_path);
if (rv != ERROR_SUCCESS)
Fail (rv);
@@ -849,8 +852,11 @@ cmd_save ()
set_privilege (SE_BACKUP_NAME);
/* REG_OPTION_BACKUP_RESTORE is necessary to save /HKLM/SECURITY */
find_key (1, KEY_QUERY_VALUE, REG_OPTION_BACKUP_RESTORE);
- char win32_path[MAX_PATH];
- cygwin_conv_to_win32_path (argv[1], win32_path);
+ ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE,
+ argv[1], NULL, 0);
+ char win32_path[len];
+ cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE, argv[1],
+ win32_path, len);
DWORD rv = RegSaveKey (key, win32_path, NULL);
if (rv != ERROR_SUCCESS)
Fail (rv);