mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 07:51:11 +02:00
move safe_mkdir & check_dir to system-helpers
Origin commit data
------------------
Commit: dfa3231469
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2012-09-11 (Tue, 11 Sep 2012)
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
#include <gui/widget/hintbox.h>
|
||||
#include <gui/widget/progresswindow.h>
|
||||
|
||||
#include <system/setting_helpers.h>
|
||||
#include <system/helpers.h>
|
||||
#include <system/settings.h>
|
||||
#include <system/debug.h>
|
||||
|
||||
|
@@ -55,7 +55,7 @@
|
||||
#include <gui/widget/hintbox.h>
|
||||
#include <gui/customcolor.h>
|
||||
#include <gui/pictureviewer.h>
|
||||
|
||||
#include <system/helpers.h>
|
||||
#include <daemonc/remotecontrol.h>
|
||||
|
||||
#include <zapit/femanager.h>
|
||||
|
@@ -51,7 +51,7 @@
|
||||
#include <driver/record.h>
|
||||
|
||||
#include <system/debug.h>
|
||||
|
||||
#include <system/helpers.h>
|
||||
|
||||
CRecordSetup::CRecordSetup()
|
||||
{
|
||||
|
@@ -28,6 +28,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/vfs.h> /* or <sys/statfs.h> */
|
||||
#include <string.h>
|
||||
|
||||
#include <system/helpers.h>
|
||||
|
||||
@@ -102,3 +106,44 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type)
|
||||
}
|
||||
return(fp);
|
||||
}
|
||||
|
||||
int safe_mkdir(char * path)
|
||||
{
|
||||
struct statfs s;
|
||||
int ret = 0;
|
||||
if(!strncmp(path, "/hdd", 4)) {
|
||||
ret = statfs("/hdd", &s);
|
||||
if((ret != 0) || (s.f_type == 0x72b6))
|
||||
ret = -1;
|
||||
else
|
||||
mkdir(path, 0755);
|
||||
} else
|
||||
mkdir(path, 0755);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int check_dir(const char * newdir)
|
||||
{
|
||||
|
||||
struct statfs s;
|
||||
if (::statfs(newdir, &s) == 0) {
|
||||
switch (s.f_type) /* f_type is long */
|
||||
{
|
||||
case 0xEF53L: /*EXT2 & EXT3*/
|
||||
case 0x6969L: /*NFS*/
|
||||
case 0xFF534D42L: /*CIFS*/
|
||||
case 0x517BL: /*SMB*/
|
||||
case 0x52654973L: /*REISERFS*/
|
||||
case 0x65735546L: /*fuse for ntfs*/
|
||||
case 0x58465342L: /*xfs*/
|
||||
case 0x4d44L: /*msdos*/
|
||||
case 0x0187: /* AUTOFS_SUPER_MAGIC */
|
||||
case 0x858458f6: /*ramfs*/
|
||||
return 0;//ok
|
||||
default:
|
||||
fprintf( stderr,"%s Unknow File system type: %i\n",newdir ,s.f_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 1; // error
|
||||
}
|
||||
|
@@ -24,5 +24,7 @@
|
||||
|
||||
int my_system(const char * cmd, const char * arg1, const char * arg2);
|
||||
FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type);
|
||||
int safe_mkdir(char * path);
|
||||
int check_dir(const char * newdir);
|
||||
|
||||
#endif
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#include "configure_network.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
@@ -44,12 +43,9 @@
|
||||
#include <libnet.h>
|
||||
#include <linux/if.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/vfs.h>
|
||||
|
||||
#if HAVE_COOL_HARDWARE
|
||||
#include <coolstream/control.h>
|
||||
@@ -566,44 +562,3 @@ bool CAutoModeNotifier::changeNotify(const neutrino_locale_t /*OptionName*/, voi
|
||||
videoDecoder->SetAutoModes(modes);
|
||||
return false;
|
||||
}
|
||||
|
||||
int safe_mkdir(char * path)
|
||||
{
|
||||
struct statfs s;
|
||||
int ret = 0;
|
||||
if(!strncmp(path, "/hdd", 4)) {
|
||||
ret = statfs("/hdd", &s);
|
||||
if((ret != 0) || (s.f_type == 0x72b6))
|
||||
ret = -1;
|
||||
else
|
||||
mkdir(path, 0755);
|
||||
} else
|
||||
mkdir(path, 0755);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int check_dir(const char * newdir)
|
||||
{
|
||||
|
||||
struct statfs s;
|
||||
if (::statfs(newdir, &s) == 0) {
|
||||
switch (s.f_type) /* f_type is long */
|
||||
{
|
||||
case 0xEF53L: /*EXT2 & EXT3*/
|
||||
case 0x6969L: /*NFS*/
|
||||
case 0xFF534D42L: /*CIFS*/
|
||||
case 0x517BL: /*SMB*/
|
||||
case 0x52654973L: /*REISERFS*/
|
||||
case 0x65735546L: /*fuse for ntfs*/
|
||||
case 0x58465342L: /*xfs*/
|
||||
case 0x4d44L: /*msdos*/
|
||||
case 0x0187: /* AUTOFS_SUPER_MAGIC */
|
||||
case 0x858458f6: /*ramfs*/
|
||||
return 0;//ok
|
||||
default:
|
||||
fprintf( stderr,"%s Unknow File system type: %i\n",newdir ,s.f_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 1; // error
|
||||
}
|
||||
|
@@ -144,9 +144,6 @@ class COnekeyPluginChangeExec : public CMenuTarget
|
||||
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||
};
|
||||
|
||||
int safe_mkdir(char * path);
|
||||
int check_dir(const char * newdir);
|
||||
|
||||
class CTZChangeNotifier : public CChangeObserver
|
||||
{
|
||||
public:
|
||||
|
Reference in New Issue
Block a user