Skip to content
This repository
Browse code

Merge pull request #2947 from mus65/os-release

[Linux] os-release: unescape quotes / backslashes
  • Loading branch information...
commit 947f666fa2ff91538ee41e2352e6ed8549dcb0fe 2 parents b804c6b + b8cd5ba
authored

Showing 1 changed file with 21 additions and 0 deletions. Show diff stats Hide diff stats

  1. 21  xbmc/utils/SystemInfo.cpp
21  xbmc/utils/SystemInfo.cpp
@@ -695,6 +695,27 @@ CStdString CSysInfo::GetLinuxDistro()
695 695
           pretty_name[strlen(pretty_name) - 1] = '\0';
696 696
         }
697 697
 
  698
+        // unescape quotes and backslashes
  699
+        char *p = pretty_name;
  700
+        while (*p)
  701
+        {
  702
+          char *this_char = p;
  703
+          char *next_char = p + 1;
  704
+
  705
+          if (*this_char == '\\' &&
  706
+              (*next_char == '\'' || *next_char == '\"' || *next_char == '\\'))
  707
+          {
  708
+            while (*this_char)
  709
+            {
  710
+              *this_char = *next_char;
  711
+              this_char++;
  712
+              next_char++;
  713
+            }
  714
+          }
  715
+
  716
+          p++;
  717
+        }
  718
+
698 719
         result = pretty_name;
699 720
         break;
700 721
       }

0 notes on commit 947f666

Please sign in to comment.
Something went wrong with that request. Please try again.