Nic
Nic

Reputation: 812

Why is mkdir() no executing on MySQL UDF running in Ubuntu?

I plan to create a log file for my UDF which will be located in /var/log directory. So I call mkdire("/var/log/my_func",...) on the C code but after calling the function from Mysql and ls, the directory is not created.

My main aim is to log UDF errors, I would also appreciate any tips on how I can log UDF errors to a file.

Here is the code sample:

struct stat sb;
if(stat("/var/log/my_log_dir", &sb) != 0 || !S_ISDIR(sb.st_mode))
    mkdir("/var/log/my_log_dir", S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);

My function return an integer, so when I comment mkdir and return a random int the returned value show on MySQL

Thnx in advance.

Upvotes: 0

Views: 53

Answers (0)

Related Questions