Index: sbin/devd/devd.hh =================================================================== --- sbin/devd/devd.hh +++ sbin/devd/devd.hh @@ -48,14 +48,17 @@ * no variable of %var is set, then %bogus will be returned. */ const std::string &get_variable(const std::string &var) const; - /** Is there a variable of %var set in thi stable? + /** Is there a variable of %var set in this table? */ bool is_set(const std::string &var) const; /** A completely bogus string. */ static const std::string bogus; static const std::string nothing; + private: + const std::string &fix_value(const std::string &val) const; + std::map _vars; }; Index: sbin/devd/devd.cc =================================================================== --- sbin/devd/devd.cc +++ sbin/devd/devd.cc @@ -410,6 +410,31 @@ return (_vars.find(var) != _vars.end()); } +/** fix_value + * Removes quoted characters that have made it this far. + */ +const std::string & +var_list::fix_value(const std::string &val) const +{ + char *tmp, *dst; + const char *src; + std::string *rv; + + tmp = new char[val.length()]; + src = val.c_str(); + while (*src) { + if (*src == '\\') { + src++; + if (*src != '\0') + break; + } + *dst++ = *src++; + } + rv = new string(tmp); + delete tmp; + return *rv; +} + void var_list::set_variable(const string &var, const string &val) { @@ -421,7 +446,7 @@ */ if (no_daemon) devdlog(LOG_DEBUG, "setting %s=%s\n", var.c_str(), val.c_str()); - _vars[var] = val; + _vars[var] = fix_value(val); } void @@ -710,8 +735,13 @@ if (*walker == '"') { walker++; // skip " rhs = walker; - while (*walker && *walker != '"') + while (*walker && *walker != '"') { + // Skip \" ... We leave it in the string and strip the \ later. + // due to the super simplistic parser that we have here. + if (*walker == '\\' && walker[1] == '"') + walker++; walker++; + } if (*walker != '"') return (false); rhs[-2] = '\0';