* Makefile.in: Add dependencies for fhandler_random.o
* fhandler.h: Add device type FH_RANDOM. Add class fhandler_dev_random. * fhandler_random.cc: New file. Implementation of fhandler_dev_random. * hinfo.cc (build_fhandler): Add case for FH_RANDOM. * path.cc: Add device names for random devices to windows_device_names. (get_device_number): Add if branch for random devices. (win32_device_name): Add device name generation for random devices. winsup.h: Include <wincrypt.h>.
This commit is contained in:
@@ -436,6 +436,7 @@ const char *windows_device_names[] =
|
||||
"\\dev\\st%d",
|
||||
"nul",
|
||||
"\\dev\\zero",
|
||||
"\\dev\\%srandom",
|
||||
};
|
||||
|
||||
static int
|
||||
@@ -500,6 +501,11 @@ get_device_number (const char *name, int &unit, BOOL from_conv)
|
||||
devn = FH_NULL;
|
||||
else if (deveq ("zero"))
|
||||
devn = FH_ZERO;
|
||||
else if (deveq ("random") || deveq ("urandom"))
|
||||
{
|
||||
devn = FH_RANDOM;
|
||||
unit = 8 + (deveqn ("u", 1) ? 1 : 0); /* Keep unit Linux conformant */
|
||||
}
|
||||
else if (deveqn ("com", 3) && (unit = digits (name + 3)) >= 0)
|
||||
devn = FH_SERIAL;
|
||||
else if (deveq ("pipe") || deveq ("piper") || deveq ("pipew"))
|
||||
@@ -535,7 +541,10 @@ win32_device_name (const char *src_path, char *win32_path,
|
||||
|
||||
if ((devfmt = windows_device_names[FHDEVN (devn)]) == NULL)
|
||||
return FALSE;
|
||||
__small_sprintf (win32_path, devfmt, unit);
|
||||
if (devn == FH_RANDOM)
|
||||
__small_sprintf (win32_path, devfmt, unit == 8 ? "" : "u");
|
||||
else
|
||||
__small_sprintf (win32_path, devfmt, unit);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user