Skip to content

Commit d2c62fb

Browse files
committed
Remove changes
1 parent 7df58bb commit d2c62fb

File tree

3 files changed

+51
-15
lines changed

3 files changed

+51
-15
lines changed

pCloudCC/control_tools.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#include "control_tools.h"
2-
#include "pclsync_lib.h"
3-
#include "overlay_client.h"
4-
51
#include <iostream>
62

73
#include <sys/types.h>
@@ -16,6 +12,10 @@
1612
#include <map>
1713
#include <string>
1814

15+
#include "control_tools.h"
16+
#include "pclsync_lib.h"
17+
#include "overlay_client.h"
18+
1919
namespace control_tools{
2020

2121
static const int STOP = 0;
@@ -115,4 +115,4 @@ int daemonize(bool do_commands) {
115115
}
116116
}
117117

118-
}
118+
}

pCloudCC/lib/pclsync/pfs.c

+40-1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ typedef off_t fuse_off_t;
7070
#include <sys/mount.h>
7171
#endif
7272

73+
#if defined(P_OS_LINUX)
74+
#include <sys/mount.h>
75+
#endif
76+
7377
#if IS_DEBUG
7478
#define psync_fs_set_thread_name() do {psync_thread_name=__FUNCTION__;} while (0)
7579
#else
@@ -2979,7 +2983,9 @@ static void *psync_fs_init(struct fuse_conn_info *conn){
29792983
conn->want|=FUSE_CAP_BIG_WRITES;
29802984
#endif
29812985
conn->max_readahead=1024*1024;
2986+
#if !defined(P_OS_LINUX)
29822987
conn->max_write=FS_MAX_WRITE;
2988+
#endif
29832989
if (psync_start_callback)
29842990
psync_timer_register(psync_fs_start_callback_timer, 1, NULL);
29852991
return 0;
@@ -3198,6 +3204,13 @@ static void psync_fs_do_stop(void){
31983204
unmount(psync_current_mountpoint, MNT_FORCE);
31993205
debug(D_NOTICE, "unmount exited");
32003206
#endif
3207+
3208+
#if defined(P_OS_LINUX)
3209+
char *mp;
3210+
mp = psync_fuse_get_mountpoint();
3211+
fuse_unmount(mp, psync_fuse_channel);
3212+
#endif
3213+
32013214
debug(D_NOTICE, "running fuse_exit");
32023215
fuse_exit(psync_fuse);
32033216
started=2;
@@ -3307,6 +3320,29 @@ static void psync_fuse_thread(){
33073320
pthread_mutex_unlock(&start_mutex);
33083321
}
33093322

3323+
// Returns true if FUSE 3 is installed on the user's machine.
3324+
// Returns false if FUSE version is less than 3.
3325+
static char is_fuse3_installed_on_system()
3326+
{
3327+
// Assuming that fusermount3 is only available on FUSE 3.
3328+
FILE* pipe = popen("which fusermount3", "r");
3329+
3330+
if (!pipe) {
3331+
return 0;
3332+
}
3333+
3334+
char output[1024];
3335+
memset(output, 0, sizeof(output));
3336+
3337+
char* o = fgets(output, sizeof(output), pipe);
3338+
3339+
pclose(pipe);
3340+
size_t outlen = strlen(output);
3341+
3342+
return outlen > 0;
3343+
}
3344+
3345+
33103346
static int psync_fs_do_start(){
33113347
char *mp;
33123348
struct fuse_operations psync_oper;
@@ -3320,7 +3356,9 @@ static int psync_fs_do_start(){
33203356
fuse_opt_add_arg(&args, "-oauto_unmount");
33213357
// fuse_opt_add_arg(&args, "-ouse_ino");
33223358
fuse_opt_add_arg(&args, "-ofsname="DEFAULT_FUSE_MOUNT_POINT".fs");
3323-
fuse_opt_add_arg(&args, "-ononempty");
3359+
if (!is_fuse3_installed_on_system()) {
3360+
fuse_opt_add_arg(&args, "-ononempty");
3361+
}
33243362
fuse_opt_add_arg(&args, "-ohard_remove");
33253363
// fuse_opt_add_arg(&args, "-d");
33263364
#endif
@@ -3481,3 +3519,4 @@ int psync_fs_remount(){
34813519
else
34823520
return 0;
34833521
}
3522+

pCloudCC/pclsync_lib.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,19 @@
3939
namespace cc = console_client;
4040
namespace clib = cc::clibrary;
4141

42-
#include <boost/shared_ptr.hpp>
4342
clib::pclsync_lib& clib::pclsync_lib::get_lib(){
4443
static clib::pclsync_lib g_lib;
45-
return g_lib;
46-
}
47-
48-
psync_timer_t exit_timer=NULL;
44+
return g_lib;}
4945

50-
static std::string exec(const char* cmd){
51-
boost::shared_ptr<FILE> pipe(popen(cmd, "r"), pclose);
46+
static std::string exec(const char* cmd) {
5247
if (!pipe) return "ERROR";
5348
char buffer[128];
5449
std::string result = "";
55-
while (!feof(pipe.get())) {
56-
if (fgets(buffer, 128, pipe.get()) != NULL)
50+
while (!feof(pipe)) {
51+
if (fgets(buffer, 128, pipe) != NULL)
5752
result += buffer;
5853
}
54+
pclose(pipe);
5955
return result;
6056
}
6157

@@ -325,3 +321,4 @@ clib::pclsync_lib::pclsync_lib() : status_(new pstatus_struct_() ), was_init_(fa
325321
clib::pclsync_lib::~pclsync_lib(){
326322
}
327323

324+

0 commit comments

Comments
 (0)