Convert the hard coded UDS server path into a variable.
This patch changes the macro for the server socket address into a global variable so that a subsequent patch can provide a way to set the variable. Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This commit is contained in:
		
							parent
							
								
									ba12da671f
								
							
						
					
					
						commit
						e5ddfd491e
					
				
							
								
								
									
										2
									
								
								clock.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								clock.c
									
									
									
									
									
								
							| @ -576,7 +576,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count, | ||||
| 	struct interface udsif; | ||||
| 
 | ||||
| 	memset(&udsif, 0, sizeof(udsif)); | ||||
| 	snprintf(udsif.name, sizeof(udsif.name), UDS_PATH); | ||||
| 	snprintf(udsif.name, sizeof(udsif.name), "%s", uds_path); | ||||
| 	udsif.transport = TRANS_UDS; | ||||
| 
 | ||||
| 	srandom(time(NULL)); | ||||
|  | ||||
							
								
								
									
										6
									
								
								uds.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								uds.c
									
									
									
									
									
								
							| @ -30,6 +30,8 @@ | ||||
| #include "transport_private.h" | ||||
| #include "uds.h" | ||||
| 
 | ||||
| char uds_path[MAX_IFNAME_SIZE + 1] = "/var/run/ptp4l"; | ||||
| 
 | ||||
| #define UDS_FILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) /*0660*/ | ||||
| 
 | ||||
| struct uds { | ||||
| @ -58,7 +60,7 @@ static int uds_open(struct transport *t, char *name, struct fdarray *fda, | ||||
| 	} | ||||
| 	memset(&sa, 0, sizeof(sa)); | ||||
| 	sa.sun_family = AF_LOCAL; | ||||
| 	strcpy(sa.sun_path, name); | ||||
| 	strncpy(sa.sun_path, name, sizeof(sa.sun_path) - 1); | ||||
| 
 | ||||
| 	unlink(name); | ||||
| 
 | ||||
| @ -72,7 +74,7 @@ static int uds_open(struct transport *t, char *name, struct fdarray *fda, | ||||
| 	/* For client use, pre load the server path. */ | ||||
| 	memset(&sa, 0, sizeof(sa)); | ||||
| 	sa.sun_family = AF_LOCAL; | ||||
| 	strcpy(sa.sun_path, UDS_PATH); | ||||
| 	strncpy(sa.sun_path, uds_path, sizeof(sa.sun_path) - 1); | ||||
| 	uds->sa = sa; | ||||
| 	uds->len = sizeof(sa); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user