char *message1,
char *message2 )
{
- int pipe_fd = (int)w; /* @@@ Hack! @@@
+ int pipe_fd = (int) (intptr_t) w; /* @@@ Hack! @@@
In the background process we call FileManip with
the file descriptor for the pipe instead of a
widget id. We rely on the fact that FileManip
else
{
if (strncmp(directory, desktop_dir, strlen(desktop_dir)) == 0)
- return_val = FileManip((Widget)pipe_s2m, mode, from, to,
+ return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from, to,
isContainer,
FileOpError, True, DESKTOP);
else
- return_val = FileManip((Widget)pipe_s2m, mode, from, to,
+ return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from, to,
isContainer,
FileOpError, True, NOT_DESKTOP);
XtFree( (char *) from );
case PIPEMSG_MERGE:
if (strncmp(directory, desktop_dir, strlen(desktop_dir)) == 0)
- return_val = FileManip((Widget)pipe_s2m, MERGE_DIR, from,
+ return_val = FileManip((Widget) (intptr_t) pipe_s2m, MERGE_DIR, from,
to, isContainer,
FileOpError, True, DESKTOP);
else
- return_val = FileManip((Widget)pipe_s2m, MERGE_DIR, from,
+ return_val = FileManip((Widget) (intptr_t) pipe_s2m, MERGE_DIR, from,
to, isContainer,
FileOpError, True, NOT_DESKTOP);
break;
break;
default:
if (strncmp(directory, desktop_dir, strlen(desktop_dir)) == 0)
- return_val = FileManip((Widget)pipe_s2m, mode, from, to,
+ return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from, to,
isContainer,FileOpError, True,
DESKTOP);
else
strcat(toFile, "/");
strcat(toFile, newFile);
- return_val = FileManip((Widget)pipe_s2m, mode, from,
+ return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from,
toFile, False, FileOpError,
True, NOT_DESKTOP);
XtFree(path);
XtFree(toFile);
}
else
- return_val = FileManip((Widget)pipe_s2m, mode, from,
+ return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from,
to, isContainer, FileOpError,
True, NOT_DESKTOP);
}
}
else
{
- return_val = FileManip((Widget)pipe_s2m, mode, from, to, TRUE,
+ return_val = FileManip((Widget) (intptr_t) pipe_s2m, mode, from, to, TRUE,
FileOpError, True, DESKTOP);
XtFree (from);
from = NULL;
XtFree(new_name);
return 1;
}
- success = FileManip((Widget)pipe_fd, MOVE_FILE, old_full_name, full_name, TRUE,
+ success = FileManip((Widget) (intptr_t) pipe_fd, MOVE_FILE, old_full_name, full_name, TRUE,
FileOpError, True, NOT_DESKTOP);
XtFree( old_full_name );
/* send a 'done' msg through the pipe */
/* Remove the original information file, and move the new one */
(void) fclose(newFile);
- (void) chown(NewTrashInfoFileName, getuid(), getgid());
+ if(-1 == chown(NewTrashInfoFileName, getuid(), getgid())) {
+ return( False );
+ }
(void) remove(TrashInfoFileName);
(void) rename(NewTrashInfoFileName, TrashInfoFileName);
- (void) chown(TrashInfoFileName, getuid(), getgid());
+ if(-1 == chown(TrashInfoFileName, getuid(), getgid())) {
+ return( False );
+ }
return( True );
}
else
to = CreateTrashFilename(baseName, TRUE);
/* move file to the trash directory */
- success = FileManip((Widget)pipe_fd, MOVE_FILE, path, to, TRUE,
+ success = FileManip((Widget) (intptr_t) pipe_fd, MOVE_FILE, path, to, TRUE,
FileOpError, True, TRASH_DIRECTORY);
if (success)
{
#endif /* SUN_PERF */
/* create a pipe */
- pipe(pipe_fd);
+ if(-1 == pipe(pipe_fd)) {
+ fprintf(stderr,
+ "%s: pipe failed error %d=%s\n",
+ pname, errno, strerror(errno));
+ return;
+ }
/* fork the process that does the actual work */
pid = fork();
if (to != NULL)
{
- status = RestoreObject((Widget)pipe_fd, MOVE_FILE, from,to,
+ status = RestoreObject((Widget) (intptr_t) pipe_fd, MOVE_FILE, from,to,
TRUE, FileOpError, False, NOT_DESKTOP,CheckedAlready);
/* restore was successful */
if(status == (int) True)
cb_data->msg = msg;
/* create a pipe */
- pipe(pipe_fd);
+ if(-1 == pipe(pipe_fd)) {
+ fprintf(stderr,
+ "%s: pipe failed, error %d=%s\n",
+ pname, errno, strerror(errno));
+ return;
+ }
/* fork the process that does the actual work */
pid = fork();
cb_data->msg = msg;
/* create a pipe */
- pipe(pipe_fd);
+ if(-1 == pipe(pipe_fd)) {
+ fprintf(stderr,
+ "%s: pipe failed, error %d=%s\n",
+ pname, errno, strerror(errno));
+ return;
+ }
/* fork the process that does the actual work */
pid = fork();