From 22830f478a2f1bac7f5fb313369a980c57512773 Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Fri, 9 Jan 2015 16:16:53 +0000 Subject: [PATCH] dtfile: resolve 19 compiler warnings. --- cde/programs/dtfile/ChangeDirP.c | 2 +- cde/programs/dtfile/FileMgr.c | 2 +- cde/programs/dtfile/FileOp.c | 20 +++++++++---------- cde/programs/dtfile/Trash.c | 33 +++++++++++++++++++++++++------- 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/cde/programs/dtfile/ChangeDirP.c b/cde/programs/dtfile/ChangeDirP.c index 6073083a..34052db9 100644 --- a/cde/programs/dtfile/ChangeDirP.c +++ b/cde/programs/dtfile/ChangeDirP.c @@ -792,7 +792,7 @@ GetStatusMsg( file_mgr_data->busy_status == busy_readdir) { if (file_mgr_data->busy_detail == 0) - sprintf (buf, (GETMESSAGE(3,5, "Reading ..."))); + sprintf (buf, "%s", (GETMESSAGE(3,5, "Reading ..."))); else if (file_mgr_data->busy_detail == 1) sprintf (buf, (GETMESSAGE(3,11, "%d Item(s)...")), file_mgr_data->busy_detail); diff --git a/cde/programs/dtfile/FileMgr.c b/cde/programs/dtfile/FileMgr.c index 303d8ce0..84ab3248 100644 --- a/cde/programs/dtfile/FileMgr.c +++ b/cde/programs/dtfile/FileMgr.c @@ -5074,7 +5074,7 @@ ShowChangeDirField ( if (w) { - if((int)client_data == FM_POPUP) + if((intptr_t) client_data == FM_POPUP) mbar = XtParent(w); else mbar = XmGetPostedFromWidget(XtParent(w)); diff --git a/cde/programs/dtfile/FileOp.c b/cde/programs/dtfile/FileOp.c index 85dc3946..6f7f9323 100644 --- a/cde/programs/dtfile/FileOp.c +++ b/cde/programs/dtfile/FileOp.c @@ -460,7 +460,7 @@ FileOpError( 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 @@ -950,11 +950,11 @@ FileMoveCopyProcess( 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 ); @@ -1155,11 +1155,11 @@ FileMoveCopyProcess( 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; @@ -1197,7 +1197,7 @@ FileMoveCopyProcess( 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 @@ -1222,14 +1222,14 @@ FileMoveCopyProcess( 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); } @@ -1377,7 +1377,7 @@ FileMoveCopyProcessDesktop( } 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; @@ -2455,7 +2455,7 @@ ChangeIconNameProcess( 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 */ diff --git a/cde/programs/dtfile/Trash.c b/cde/programs/dtfile/Trash.c index 09df7b73..b49c66ba 100644 --- a/cde/programs/dtfile/Trash.c +++ b/cde/programs/dtfile/Trash.c @@ -704,10 +704,14 @@ WriteTrashEntries( void ) /* 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 @@ -2830,7 +2834,7 @@ MoveToTrashProcess( 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) { @@ -3366,7 +3370,12 @@ MoveToTrash( #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(); @@ -3512,7 +3521,7 @@ RestoreProcess( 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) @@ -3756,7 +3765,12 @@ RestoreFromTrash( 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(); @@ -4076,7 +4090,12 @@ EmptyTrash( 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(); -- 2.25.1