]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Strip off the last dot and everything to the right of it in the hostname when automat...
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Tue, 9 Aug 2022 12:00:55 +0000 (13:00 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Tue, 9 Aug 2022 12:00:55 +0000 (13:00 +0100)
shairport.c

index 91bc44164c221af77b7b544869df6ad4b9fd9db9..b4ad115b340e5220d04fb3d7fb92e33d4d1bdc99 100644 (file)
@@ -1454,6 +1454,11 @@ int parse_options(int argc, char **argv) {
   // now, do the substitutions in the service name
   char hostname[100];
   gethostname(hostname, 100);
+  
+  // strip off a terminating .<anything>, e.g. .local from the hostname
+  char *last_dot = strrchr(hostname,'.');
+  if (last_dot != NULL)
+    *last_dot = '\0';
 
   char *i0;
   if (raw_service_name == NULL)