lib/run_part: Adjust style
Remove some of these whitespaces. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
This commit is contained in:
committed by
Iker Pedrosa
parent
76c97ed7ec
commit
dd6cddd481
@@ -15,7 +15,7 @@
|
||||
#include "shadowlog_internal.h"
|
||||
|
||||
|
||||
static int run_part (char *script_path, const char *name, const char *action)
|
||||
static int run_part(char *script_path, const char *name, const char *action)
|
||||
{
|
||||
pid_t pid;
|
||||
int wait_status;
|
||||
@@ -24,34 +24,34 @@ static int run_part (char *script_path, const char *name, const char *action)
|
||||
|
||||
pid=fork();
|
||||
if (pid==-1) {
|
||||
fprintf (shadow_logfd, "fork: %s\n", strerror(errno));
|
||||
fprintf(shadow_logfd, "fork: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
if (pid==0) {
|
||||
setenv ("ACTION",action,1);
|
||||
setenv ("SUBJECT",name,1);
|
||||
execv (script_path,args);
|
||||
fprintf (shadow_logfd, "execv: %s\n", strerror(errno));
|
||||
setenv("ACTION",action,1);
|
||||
setenv("SUBJECT",name,1);
|
||||
execv(script_path,args);
|
||||
fprintf(shadow_logfd, "execv: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pid_status = wait (&wait_status);
|
||||
pid_status = wait(&wait_status);
|
||||
if (pid_status == pid) {
|
||||
return (wait_status);
|
||||
}
|
||||
|
||||
fprintf (shadow_logfd, "waitpid: %s\n", strerror(errno));
|
||||
fprintf(shadow_logfd, "waitpid: %s\n", strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
|
||||
int run_parts (const char *directory, const char *name, const char *action)
|
||||
int run_parts(const char *directory, const char *name, const char *action)
|
||||
{
|
||||
struct dirent **namelist;
|
||||
int scanlist;
|
||||
int n;
|
||||
int execute_result = 0;
|
||||
|
||||
scanlist = scandir (directory, &namelist, 0, alphasort);
|
||||
scanlist = scandir(directory, &namelist, 0, alphasort);
|
||||
if (scanlist<=0) {
|
||||
return (0);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ int run_parts (const char *directory, const char *name, const char *action)
|
||||
struct stat sb;
|
||||
|
||||
if (asprintf(&s, "%s/%s", directory, namelist[n]->d_name) == -1) {
|
||||
fprintf (shadow_logfd, "asprintf: %s\n", strerror(errno));
|
||||
fprintf(shadow_logfd, "asprintf: %s\n", strerror(errno));
|
||||
for (; n<scanlist; n++) {
|
||||
free(namelist[n]);
|
||||
}
|
||||
@@ -70,35 +70,35 @@ int run_parts (const char *directory, const char *name, const char *action)
|
||||
}
|
||||
|
||||
execute_result = 0;
|
||||
if (stat (s, &sb) == -1) {
|
||||
fprintf (shadow_logfd, "stat: %s\n", strerror(errno));
|
||||
if (stat(s, &sb) == -1) {
|
||||
fprintf(shadow_logfd, "stat: %s\n", strerror(errno));
|
||||
free(s);
|
||||
for (; n<scanlist; n++) {
|
||||
free (namelist[n]);
|
||||
free(namelist[n]);
|
||||
}
|
||||
free (namelist);
|
||||
free(namelist);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (S_ISREG (sb.st_mode) || S_ISLNK (sb.st_mode)) {
|
||||
execute_result = run_part (s, name, action);
|
||||
if (S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode)) {
|
||||
execute_result = run_part(s, name, action);
|
||||
}
|
||||
|
||||
free(s);
|
||||
|
||||
if (execute_result!=0) {
|
||||
fprintf (shadow_logfd,
|
||||
fprintf(shadow_logfd,
|
||||
"%s: did not exit cleanly.\n",
|
||||
namelist[n]->d_name);
|
||||
for (; n<scanlist; n++) {
|
||||
free (namelist[n]);
|
||||
free(namelist[n]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
free (namelist[n]);
|
||||
free(namelist[n]);
|
||||
}
|
||||
free (namelist);
|
||||
free(namelist);
|
||||
|
||||
return (execute_result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user