OSDN Git Service

am 50c6639a: Merge "Use StringPrintf."
authorElliott Hughes <enh@google.com>
Tue, 3 Feb 2015 23:46:26 +0000 (23:46 +0000)
committerAndroid Git Automerger <android-git-automerger@android.com>
Tue, 3 Feb 2015 23:46:26 +0000 (23:46 +0000)
* commit '50c6639a55b3208b64adc691b181a90e1e6de223':
  Use StringPrintf.

1  2 
server/InterfaceController.cpp

@@@ -20,8 -20,8 +20,9 @@@
  
  #define LOG_TAG "InterfaceController"
  #include <cutils/log.h>
 +#include <logwrap/logwrap.h>
  #include <utils/file.h>
+ #include <utils/stringprintf.h>
  
  #include "InterfaceController.h"
  #include "RouteController.h"
@@@ -148,13 -114,6 +143,11 @@@ int InterfaceController::setMtu(const c
                errno = ENOENT;
                return -1;
        }
-       asprintf(&path, "%s/%s/mtu", sys_net_path, interface);
-       bool success = android::WriteStringToFile(mtu, path);
-       free(path);
-       return success;
+       std::string path(android::StringPrintf("%s/%s/mtu", sys_net_path, interface));
+       return android::WriteStringToFile(mtu, path);
  }
 +
 +void InterfaceController::setIPv6OptimisticMode(const char *value) {
 +      setOnAllInterfaces("optimistic_dad", value);
 +      setOnAllInterfaces("use_optimistic", value);
 +}