Commit 40424f5fff65c7ae8763ca69ff3a9b8ddd8e2760
Committed by
Greg Kroah-Hartman
1 parent
10d498b13f
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
tools/hv: Fix /var subdirectory
Initial patch by Ben Hutchings <ben@decadent.org.uk> We will install this in /usr, so it must use /var/lib for its state. Only programs installed under /opt should use /var/opt. Signed-off-by: Tomas Hozza <thozza@redhat.com> Acked-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 6 additions and 6 deletions Side-by-side Diff
tools/hv/hv_kvp_daemon.c
... | ... | @@ -97,7 +97,7 @@ |
97 | 97 | * The location of the interface configuration file. |
98 | 98 | */ |
99 | 99 | |
100 | -#define KVP_CONFIG_LOC "/var/opt/" | |
100 | +#define KVP_CONFIG_LOC "/var/lib/hyperv" | |
101 | 101 | |
102 | 102 | #define MAX_FILE_NAME 100 |
103 | 103 | #define ENTRIES_PER_BLOCK 50 |
... | ... | @@ -234,9 +234,9 @@ |
234 | 234 | int i; |
235 | 235 | int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK; |
236 | 236 | |
237 | - if (access("/var/opt/hyperv", F_OK)) { | |
238 | - if (mkdir("/var/opt/hyperv", S_IRUSR | S_IWUSR | S_IROTH)) { | |
239 | - syslog(LOG_ERR, " Failed to create /var/opt/hyperv"); | |
237 | + if (access(KVP_CONFIG_LOC, F_OK)) { | |
238 | + if (mkdir(KVP_CONFIG_LOC, S_IRUSR | S_IWUSR | S_IROTH)) { | |
239 | + syslog(LOG_ERR, " Failed to create %s", KVP_CONFIG_LOC); | |
240 | 240 | exit(EXIT_FAILURE); |
241 | 241 | } |
242 | 242 | } |
... | ... | @@ -245,7 +245,7 @@ |
245 | 245 | fname = kvp_file_info[i].fname; |
246 | 246 | records_read = 0; |
247 | 247 | num_blocks = 1; |
248 | - sprintf(fname, "/var/opt/hyperv/.kvp_pool_%d", i); | |
248 | + sprintf(fname, "%s/.kvp_pool_%d", KVP_CONFIG_LOC, i); | |
249 | 249 | fd = open(fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IROTH); |
250 | 250 | |
251 | 251 | if (fd == -1) |
... | ... | @@ -1271,7 +1271,7 @@ |
1271 | 1271 | */ |
1272 | 1272 | |
1273 | 1273 | snprintf(if_file, sizeof(if_file), "%s%s%s", KVP_CONFIG_LOC, |
1274 | - "hyperv/ifcfg-", if_name); | |
1274 | + "/ifcfg-", if_name); | |
1275 | 1275 | |
1276 | 1276 | file = fopen(if_file, "w"); |
1277 | 1277 |