* net.cc (cygwin_getsockopt): Allow NULL optval.
* path.cc (mount_info::read_cygdrive_info_from_registry): Don't write cygdrive to registry if it doesn't exist.
This commit is contained in:
		| @@ -1,3 +1,10 @@ | |||||||
|  | 2001-12-03  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
|  | 	* net.cc (cygwin_getsockopt): Allow NULL optval. | ||||||
|  |  | ||||||
|  | 	* path.cc (mount_info::read_cygdrive_info_from_registry): Don't write | ||||||
|  | 	cygdrive to registry if it doesn't exist. | ||||||
|  |  | ||||||
| 2001-12-03  Christopher Faylor  <cgf@redhat.com> | 2001-12-03  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
| 	* path.cc (mount_info::conv_to_win32_path): Avoid returning error if | 	* path.cc (mount_info::conv_to_win32_path): Avoid returning error if | ||||||
|   | |||||||
| @@ -613,11 +613,11 @@ static int get_inet_addr (const struct sockaddr *in, int inlen, | |||||||
| /* exported as sendto: standards? */ | /* exported as sendto: standards? */ | ||||||
| extern "C" int | extern "C" int | ||||||
| cygwin_sendto (int fd, | cygwin_sendto (int fd, | ||||||
| 		 const void *buf, | 	       const void *buf, | ||||||
| 		 int len, | 	       int len, | ||||||
| 		 unsigned int flags, | 	       unsigned int flags, | ||||||
| 		 const struct sockaddr *to, | 	       const struct sockaddr *to, | ||||||
| 		 int tolen) | 	       int tolen) | ||||||
| { | { | ||||||
|   int res; |   int res; | ||||||
|   wsock_event wsock_evt; |   wsock_event wsock_evt; | ||||||
| @@ -684,7 +684,7 @@ cygwin_recvfrom (int fd, | |||||||
|  |  | ||||||
|   if (__check_null_invalid_struct_errno (buf, (unsigned) len) |   if (__check_null_invalid_struct_errno (buf, (unsigned) len) | ||||||
|       || check_null_invalid_struct_errno (fromlen) |       || check_null_invalid_struct_errno (fromlen) | ||||||
|       || __check_null_invalid_struct_errno (from, (unsigned) *fromlen) |       || (from && __check_null_invalid_struct_errno (from, (unsigned) *fromlen)) | ||||||
|       || !h) |       || !h) | ||||||
|     res = -1; |     res = -1; | ||||||
|   else |   else | ||||||
| @@ -735,7 +735,7 @@ cygwin_setsockopt (int fd, | |||||||
|   int res = -1; |   int res = -1; | ||||||
|   const char *name = "error"; |   const char *name = "error"; | ||||||
|  |  | ||||||
|   if (!__check_invalid_read_ptr_errno (optval, optlen) && h) |   if ((!optval || !__check_invalid_read_ptr_errno (optval, optlen)) && h) | ||||||
|     { |     { | ||||||
|       /* For the following debug_printf */ |       /* For the following debug_printf */ | ||||||
|       switch (optname) |       switch (optname) | ||||||
| @@ -799,7 +799,7 @@ cygwin_getsockopt (int fd, | |||||||
|   int res = -1; |   int res = -1; | ||||||
|   const char *name = "error"; |   const char *name = "error"; | ||||||
|   if (!check_null_invalid_struct_errno (optlen) |   if (!check_null_invalid_struct_errno (optlen) | ||||||
|       && !__check_null_invalid_struct_errno (optval, (unsigned) optlen) |       && (!optval || !__check_null_invalid_struct_errno (optval, (unsigned) optlen)) | ||||||
|       && h) |       && h) | ||||||
|     { |     { | ||||||
|       /* For the following debug_printf */ |       /* For the following debug_printf */ | ||||||
|   | |||||||
| @@ -1867,8 +1867,7 @@ mount_info::read_cygdrive_info_from_registry () | |||||||
|   /* reg_key for user path prefix in HKEY_CURRENT_USER. */ |   /* reg_key for user path prefix in HKEY_CURRENT_USER. */ | ||||||
|   reg_key r; |   reg_key r; | ||||||
|  |  | ||||||
|   if (r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, sizeof (cygdrive), |   if (r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, sizeof (cygdrive), "") != 0) | ||||||
|       "") != 0) |  | ||||||
|     { |     { | ||||||
|       /* Didn't find the user path prefix so check the system path prefix. */ |       /* Didn't find the user path prefix so check the system path prefix. */ | ||||||
|  |  | ||||||
| @@ -1878,22 +1877,12 @@ mount_info::read_cygdrive_info_from_registry () | |||||||
| 		 CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, | 		 CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, | ||||||
| 		 NULL); | 		 NULL); | ||||||
|  |  | ||||||
|     if (r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, sizeof (cygdrive), |       if (r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, | ||||||
| 	"") != 0) | 	  sizeof (cygdrive), "")) | ||||||
|       { | 	strcpy (cygdrive, CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX); | ||||||
| 	/* Didn't find either so write the default to the registry and use it. |       cygdrive_flags = r2.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO); | ||||||
| 	   NOTE: We are writing and using the user path prefix.  */ |       slashify (cygdrive, cygdrive, 1); | ||||||
| 	write_cygdrive_info_to_registry (CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX, |       cygdrive_len = strlen (cygdrive); | ||||||
| 					 MOUNT_AUTO); |  | ||||||
|       } |  | ||||||
|     else |  | ||||||
|       { |  | ||||||
| 	/* Fetch system cygdrive_flags from registry; returns MOUNT_AUTO on |  | ||||||
| 	   error. */ |  | ||||||
| 	cygdrive_flags = r2.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO); |  | ||||||
| 	slashify (cygdrive, cygdrive, 1); |  | ||||||
| 	cygdrive_len = strlen(cygdrive); |  | ||||||
|       } |  | ||||||
|     } |     } | ||||||
|   else |   else | ||||||
|     { |     { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user