|
@@ -245,26 +245,30 @@ LIGHT_BOOL light_initialize(int argc, char** argv)
|
245
|
245
|
return TRUE;
|
246
|
246
|
}
|
247
|
247
|
|
248
|
|
- /* Make sure we have a valid /etc/light directory, as well as mincap and save */
|
249
|
|
- mkdirVal = mkdir("/etc/light", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
250
|
|
- if(mkdirVal != 0 && errno != EEXIST)
|
|
248
|
+ if(mode == LIGHT_SAVE ||
|
|
249
|
+ (mode == LIGHT_SET && light_Configuration.target == LIGHT_MIN_CAP))
|
251
|
250
|
{
|
252
|
|
- LIGHT_ERR("/etc/light does not exist and could not be created");
|
253
|
|
- return FALSE;
|
254
|
|
- }
|
|
251
|
+ /* Make sure we have a valid /etc/light directory, as well as mincap and save */
|
|
252
|
+ mkdirVal = mkdir("/etc/light", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
|
253
|
+ if(mkdirVal != 0 && errno != EEXIST)
|
|
254
|
+ {
|
|
255
|
+ LIGHT_ERR("/etc/light does not exist and could not be created, make sure this application is run as root.");
|
|
256
|
+ return FALSE;
|
|
257
|
+ }
|
255
|
258
|
|
256
|
|
- mkdirVal = mkdir("/etc/light/mincap", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
257
|
|
- if(mkdirVal != 0 && errno != EEXIST)
|
258
|
|
- {
|
259
|
|
- LIGHT_ERR("/etc/light/mincap does not exist and could not be created");
|
260
|
|
- return FALSE;
|
261
|
|
- }
|
|
259
|
+ mkdirVal = mkdir("/etc/light/mincap", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
|
260
|
+ if(mkdirVal != 0 && errno != EEXIST)
|
|
261
|
+ {
|
|
262
|
+ LIGHT_ERR("/etc/light/mincap does not exist and could not be created, make sure this application is run as root.");
|
|
263
|
+ return FALSE;
|
|
264
|
+ }
|
262
|
265
|
|
263
|
|
- mkdirVal = mkdir("/etc/light/save", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
264
|
|
- if(mkdirVal != 0 && errno != EEXIST)
|
265
|
|
- {
|
266
|
|
- LIGHT_ERR("/etc/light/save does not exist and could not be created");
|
267
|
|
- return FALSE;
|
|
266
|
+ mkdirVal = mkdir("/etc/light/save", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
|
267
|
+ if(mkdirVal != 0 && errno != EEXIST)
|
|
268
|
+ {
|
|
269
|
+ LIGHT_ERR("/etc/light/save does not exist and could not be created, make sure this application is run as root.");
|
|
270
|
+ return FALSE;
|
|
271
|
+ }
|
268
|
272
|
}
|
269
|
273
|
|
270
|
274
|
/* Make sure we have a valid controller before we proceed */
|