Rewrite upgrade-simple to C++
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) Vitaliy Filippov, 2019+
|
||||
// License: VNPL-1.1 (see README.md for details)
|
||||
|
||||
#include <sys/file.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "disk_tool.h"
|
||||
@@ -109,6 +110,11 @@ uint32_t disk_tool_t::write_osd_superblock(std::string device, json11::Json para
|
||||
free(buf);
|
||||
return 0;
|
||||
}
|
||||
// Lock the file
|
||||
if (flock(fd, LOCK_EX|LOCK_NB) < 0)
|
||||
{
|
||||
fprintf(stderr, "Warning: Failed to lock %s with flock - udev autodetection may fail. Error: %s\n", device.c_str(), strerror(errno));
|
||||
}
|
||||
int r = write_blocking(fd, buf, buf_len);
|
||||
if (r < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user