X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ovsdb%2Ffile.c;h=43fcb95643e93f387e69a2fb21887099a2a97f5e;hb=6e5877ecdacf66905afd2481d0025d3fd7d9132f;hp=9eea460d4dd993cc15fff3e30ffc9d03c2fd6444;hpb=8c7ea6a0c0d44f707eef136b77ac0dd1c55509a4;p=openvswitch diff --git a/ovsdb/file.c b/ovsdb/file.c index 9eea460d..43fcb956 100644 --- a/ovsdb/file.c +++ b/ovsdb/file.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010, 2011 Nicira Networks +/* Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -333,10 +333,9 @@ ovsdb_file_txn_row_from_json(struct ovsdb_txn *txn, struct ovsdb_table *table, error = ovsdb_file_update_row_from_json(new, converting, json); if (error) { ovsdb_row_destroy(new); + } else { + ovsdb_txn_row_insert(txn, new); } - - ovsdb_txn_row_insert(txn, new); - return error; } } @@ -532,11 +531,14 @@ ovsdb_file_create(struct ovsdb *db, struct ovsdb_log *log, { long long int now = time_msec(); struct ovsdb_file *file; + char *deref_name; char *abs_name; /* Use the absolute name of the file because ovsdb-server opens its * database before daemonize() chdirs to "/". */ - abs_name = abs_file_name(NULL, file_name); + deref_name = follow_symlinks(file_name); + abs_name = abs_file_name(NULL, deref_name); + free(deref_name); if (!abs_name) { *filep = NULL; return ovsdb_io_error(0, "could not determine current " @@ -647,7 +649,7 @@ ovsdb_file_compact(struct ovsdb_file *file) /* Lock temporary file. */ tmp_name = xasprintf("%s.tmp", file->file_name); - retval = lockfile_lock(tmp_name, 0, &tmp_lock); + retval = lockfile_lock(tmp_name, &tmp_lock); if (retval) { error = ovsdb_io_error(retval, "could not get lock on %s", tmp_name); goto exit;