mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-19 04:49:25 +08:00
* cygpath.cc (do_sysfolders): Use cygwin_conv_path.
(do_pathconv): Use cygwin_conv_path and cygwin_conv_path_list. * dumper.cc (main): Use cygwin_conv_path. Allocate target path dynamically. * mkpasswd.c (current_user): Use cygwin_conv_path. (enum_users): Ditto. * ps.cc (NT_MAX_PATH): Define. (main): Use cygwin_conv_path. * regtool.cc (find_key): Ditto. Allocate target path dynamically. (cmd_save): Ditto.
This commit is contained in:
parent
edab6053a2
commit
2b2b42cf59
@ -1,3 +1,16 @@
|
||||
2008-03-12 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* cygpath.cc (do_sysfolders): Use cygwin_conv_path.
|
||||
(do_pathconv): Use cygwin_conv_path and cygwin_conv_path_list.
|
||||
* dumper.cc (main): Use cygwin_conv_path. Allocate target path
|
||||
dynamically.
|
||||
* mkpasswd.c (current_user): Use cygwin_conv_path.
|
||||
(enum_users): Ditto.
|
||||
* ps.cc (NT_MAX_PATH): Define.
|
||||
(main): Use cygwin_conv_path.
|
||||
* regtool.cc (find_key): Ditto. Allocate target path dynamically.
|
||||
(cmd_save): Ditto.
|
||||
|
||||
2008-03-11 Brian Dessent <brian@dessent.net>
|
||||
|
||||
* cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1
|
||||
|
@ -607,7 +607,8 @@ do_sysfolders (char option)
|
||||
}
|
||||
else if (!windows_flag)
|
||||
{
|
||||
if (cygwin_conv_to_posix_path (buf, buf2))
|
||||
if (cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_RELATIVE, buf, buf2,
|
||||
MAX_PATH))
|
||||
fprintf (stderr, "%s: error converting \"%s\" - %s\n",
|
||||
prog_name, buf, strerror (errno));
|
||||
else
|
||||
@ -646,8 +647,10 @@ do_pathconv (char *filename)
|
||||
{
|
||||
char *buf;
|
||||
DWORD len;
|
||||
int err;
|
||||
int (*conv_func) (const char *, char *);
|
||||
ssize_t err;
|
||||
cygwin_conv_path_t conv_func =
|
||||
(unix_flag ? CCP_WIN_A_TO_POSIX : CCP_POSIX_TO_WIN_A)
|
||||
| (absolute_flag ? CCP_ABSOLUTE : CCP_RELATIVE);
|
||||
|
||||
if (!path_flag)
|
||||
{
|
||||
@ -662,10 +665,8 @@ do_pathconv (char *filename)
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
else if (unix_flag)
|
||||
len = cygwin_win32_to_posix_path_list_buf_size (filename);
|
||||
else
|
||||
len = cygwin_posix_to_win32_path_list_buf_size (filename);
|
||||
len = cygwin_conv_path_list (conv_func, filename, NULL, 0);
|
||||
|
||||
buf = (char *) malloc (len);
|
||||
if (buf == NULL)
|
||||
@ -676,11 +677,9 @@ do_pathconv (char *filename)
|
||||
|
||||
if (path_flag)
|
||||
{
|
||||
if (unix_flag)
|
||||
err = cygwin_win32_to_posix_path_list (filename, buf);
|
||||
else
|
||||
err = cygwin_conv_path_list (conv_func, filename, buf, len);
|
||||
if (!unix_flag)
|
||||
{
|
||||
err = cygwin_posix_to_win32_path_list (filename, buf);
|
||||
if (err)
|
||||
/* oops */;
|
||||
buf = get_device_paths (buf);
|
||||
@ -700,13 +699,7 @@ do_pathconv (char *filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (unix_flag)
|
||||
conv_func = (absolute_flag ? cygwin_conv_to_full_posix_path :
|
||||
cygwin_conv_to_posix_path);
|
||||
else
|
||||
conv_func = (absolute_flag ? cygwin_conv_to_full_win32_path :
|
||||
cygwin_conv_to_win32_path);
|
||||
err = conv_func (filename, buf);
|
||||
err = cygwin_conv_path (conv_func, filename, buf, len);
|
||||
if (err)
|
||||
{
|
||||
fprintf (stderr, "%s: error converting \"%s\" - %s\n",
|
||||
|
@ -888,7 +888,6 @@ main (int argc, char **argv)
|
||||
int opt;
|
||||
const char *p = "";
|
||||
DWORD pid;
|
||||
char win32_name [MAX_PATH];
|
||||
|
||||
while ((opt = getopt_long (argc, argv, "dqhv", longopts, NULL) ) != EOF)
|
||||
switch (opt)
|
||||
@ -911,8 +910,11 @@ main (int argc, char **argv)
|
||||
|
||||
if (argv && *(argv + optind) && *(argv + optind +1))
|
||||
{
|
||||
*win32_name = '\0';
|
||||
cygwin_conv_to_win32_path (*(argv + optind), win32_name);
|
||||
ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE,
|
||||
*(argv + optind), NULL, 0);
|
||||
char *win32_name = (char *) alloca (len);
|
||||
cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE, *(argv + optind),
|
||||
win32_name, len);
|
||||
if ((p = strrchr (win32_name, '\\')))
|
||||
p++;
|
||||
else
|
||||
|
@ -197,7 +197,8 @@ current_user (int print_sids, int print_cygpath,
|
||||
strlcat (homedir_w32, "\\", sizeof (homedir_w32));
|
||||
strlcat (homedir_w32, envhomepath, sizeof (homedir_w32));
|
||||
if (print_cygpath)
|
||||
cygwin_conv_to_posix_path (homedir_w32, homedir_psx);
|
||||
cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, homedir_w32,
|
||||
homedir_psx, MAX_PATH);
|
||||
else
|
||||
psx_dir (homedir_w32, homedir_psx);
|
||||
}
|
||||
@ -298,7 +299,8 @@ enum_users (LPWSTR servername, int print_sids, int print_cygpath,
|
||||
if (homedir_w32[0] != '\0')
|
||||
{
|
||||
if (print_cygpath)
|
||||
cygwin_conv_to_posix_path (homedir_w32, homedir_psx);
|
||||
cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE,
|
||||
homedir_w32, homedir_psx, MAX_PATH);
|
||||
else
|
||||
psx_dir (homedir_w32, homedir_psx);
|
||||
}
|
||||
|
@ -20,6 +20,10 @@ details. */
|
||||
#include <tlhelp32.h>
|
||||
#include <psapi.h>
|
||||
|
||||
/* Maximum possible path length under NT. There's no official define
|
||||
for that value. Note that PATH_MAX is only 4K. */
|
||||
#define NT_MAX_PATH 32768
|
||||
|
||||
static const char version[] = "$Revision$";
|
||||
static char *prog_name;
|
||||
|
||||
@ -355,7 +359,9 @@ main (int argc, char *argv[])
|
||||
else if (p->process_state & PID_TTYOU)
|
||||
status = 'O';
|
||||
|
||||
char pname[PATH_MAX];
|
||||
/* Maximum possible path length under NT. There's no official define
|
||||
for that value. */
|
||||
char pname[NT_MAX_PATH];
|
||||
if (p->process_state & PID_EXITED || (p->exitcode & ~0xffff))
|
||||
strcpy (pname, "<defunct>");
|
||||
else if (p->ppid)
|
||||
@ -363,9 +369,11 @@ main (int argc, char *argv[])
|
||||
char *s;
|
||||
pname[0] = '\0';
|
||||
if (p->version >= EXTERNAL_PINFO_VERSION_32_LP)
|
||||
cygwin_conv_to_posix_path (p->progname_long, pname);
|
||||
cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE,
|
||||
p->progname_long, pname, NT_MAX_PATH);
|
||||
else
|
||||
cygwin_conv_to_posix_path (p->progname, pname);
|
||||
cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE,
|
||||
p->progname, pname, NT_MAX_PATH);
|
||||
s = strchr (pname, '\0') - 4;
|
||||
if (s > pname && strcasecmp (s, ".exe") == 0)
|
||||
*s = '\0';
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user