mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 15:32:52 +02:00
add wakeup_hdd & file_exists to system-helpers
Origin commit data
------------------
Branch: ni/coolstream
Commit: c6ae7255ac
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2012-09-11 (Tue, 11 Sep 2012)
Origin message was:
------------------
-add wakeup_hdd & file_exists to system-helpers
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -32,9 +32,33 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/vfs.h> /* or <sys/statfs.h> */
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <system/helpers.h>
|
||||
|
||||
bool file_exists(const char *filename)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
if(::stat(filename, &stat_buf) == 0)
|
||||
{
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void wakeup_hdd(const char *hdd_dir)
|
||||
{
|
||||
if(!check_dir(hdd_dir)){
|
||||
std::string wakeup_file = hdd_dir;
|
||||
wakeup_file += "/.wakeup";
|
||||
remove(wakeup_file.c_str());
|
||||
creat(wakeup_file.c_str(),S_IREAD|S_IWRITE);
|
||||
sync();
|
||||
}
|
||||
}
|
||||
|
||||
int my_system(const char * cmd, const char * arg1, const char * arg2)
|
||||
{
|
||||
int i;
|
||||
|
Reference in New Issue
Block a user