mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
Changes into src directory:
* src/background.c: * handling read() errors in background_attention() * handling IO errors in parent_call_string() * ignoring IO errors in background_attention() * ignoring write() errors in parent_call_header() * ignore IO errors in parent_call() * src/cons.saver.c: * handling IO errors in show_console_contents_linux() * handling IO errors in handle_console_linux() * src/file.c: handling mc_chdir() errors in panel_operate * src/find.c: ignoring errors on chdir() call * src/main.c: * ignoring errors on last write()'s in main() * ignoring mc_chdir() errors in setup_dummy_mc() * ignoring mc_chdir() errors in translated_mc_chdir() * src/panelize.c: ignoring errors on chdir() call * src/screen.c: * ignoring mc_chdir() errors in panel_new_with_dir() * ignoring mc_chdir() errors in reload_panelized() * ignoring mc_chdir() errors in update_panels() * src/subshell.c: ignoring errors on chdir() call * src/tree.c: ignoring mc_chdir() errors in tree_rescan() * src/treestore.c: handling read errors in tree_store_load_from() * src/widget.c: handling mc_write() errors in save_text_to_clip_file Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
303833d590
commit
35dae723ee
@ -256,7 +256,7 @@ background_attention (int fd, void *closure)
|
||||
/* void *routine;*/
|
||||
int argc, i, result, status;
|
||||
char *data [MAXCALLARGS];
|
||||
ssize_t bytes;
|
||||
ssize_t bytes, ret;
|
||||
struct TaskList *p;
|
||||
int to_child_fd = -1;
|
||||
enum ReturnType type;
|
||||
@ -284,24 +284,41 @@ background_attention (int fd, void *closure)
|
||||
return 0;
|
||||
}
|
||||
|
||||
read (fd, &argc, sizeof (argc));
|
||||
if ((read (fd, &argc, sizeof (argc)) != sizeof (argc)) ||
|
||||
(read (fd, &type, sizeof (type)) != sizeof (type)) ||
|
||||
(read (fd, &have_ctx, sizeof (have_ctx)) != sizeof (have_ctx)))
|
||||
{
|
||||
message (D_ERROR, _(" Background protocol error "),_("Reading failed"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc > MAXCALLARGS){
|
||||
message (D_ERROR, _(" Background protocol error "),
|
||||
_(" Background process sent us a request for more arguments \n"
|
||||
" than we can handle. \n"));
|
||||
}
|
||||
read (fd, &type, sizeof (type));
|
||||
read (fd, &have_ctx, sizeof (have_ctx));
|
||||
|
||||
if (have_ctx)
|
||||
read (fd, ctx, sizeof (FileOpContext));
|
||||
{
|
||||
if (read (fd, ctx, sizeof (FileOpContext)) != sizeof (FileOpContext))
|
||||
{
|
||||
message (D_ERROR, _(" Background protocol error "),_("Reading failed"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < argc; i++){
|
||||
int size;
|
||||
|
||||
read (fd, &size, sizeof (size));
|
||||
if (read (fd, &size, sizeof (size)) != sizeof (size)) {
|
||||
message (D_ERROR, _(" Background protocol error "),_("Reading failed"));
|
||||
return 0;
|
||||
}
|
||||
data [i] = g_malloc (size+1);
|
||||
read (fd, data [i], size);
|
||||
|
||||
if (read (fd, data [i], size) != size) {
|
||||
message (D_ERROR, _(" Background protocol error "),_("Reading failed"));
|
||||
return 0;
|
||||
}
|
||||
data [i][size] = 0; /* NULL terminate the blocks (they could be strings) */
|
||||
}
|
||||
|
||||
@ -357,9 +374,9 @@ background_attention (int fd, void *closure)
|
||||
}
|
||||
|
||||
/* Send the result code and the value for shared variables */
|
||||
write (to_child_fd, &result, sizeof (int));
|
||||
ret = write (to_child_fd, &result, sizeof (int));
|
||||
if (have_ctx && to_child_fd != -1)
|
||||
write (to_child_fd, ctx, sizeof (FileOpContext));
|
||||
ret = write (to_child_fd, ctx, sizeof (FileOpContext));
|
||||
} else if (type == Return_String) {
|
||||
int len;
|
||||
char *resstr = NULL;
|
||||
@ -387,14 +404,14 @@ background_attention (int fd, void *closure)
|
||||
}
|
||||
if (resstr){
|
||||
len = strlen (resstr);
|
||||
write (to_child_fd, &len, sizeof (len));
|
||||
ret = write (to_child_fd, &len, sizeof (len));
|
||||
if (len){
|
||||
write (to_child_fd, resstr, len);
|
||||
g_free (resstr);
|
||||
}
|
||||
g_free (resstr);
|
||||
} else {
|
||||
len = 0;
|
||||
write (to_child_fd, &len, sizeof (len));
|
||||
ret = write (to_child_fd, &len, sizeof (len));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < argc; i++)
|
||||
@ -417,16 +434,17 @@ static void
|
||||
parent_call_header (void *routine, int argc, enum ReturnType type, FileOpContext *ctx)
|
||||
{
|
||||
int have_ctx;
|
||||
ssize_t ret;
|
||||
|
||||
have_ctx = (ctx != NULL);
|
||||
|
||||
write (parent_fd, &routine, sizeof (routine));
|
||||
write (parent_fd, &argc, sizeof (int));
|
||||
write (parent_fd, &type, sizeof (type));
|
||||
write (parent_fd, &have_ctx, sizeof (have_ctx));
|
||||
ret = write (parent_fd, &routine, sizeof (routine));
|
||||
ret = write (parent_fd, &argc, sizeof (int));
|
||||
ret = write (parent_fd, &type, sizeof (type));
|
||||
ret = write (parent_fd, &have_ctx, sizeof (have_ctx));
|
||||
|
||||
if (have_ctx)
|
||||
write (parent_fd, ctx, sizeof (FileOpContext));
|
||||
ret = write (parent_fd, ctx, sizeof (FileOpContext));
|
||||
}
|
||||
|
||||
int
|
||||
@ -434,6 +452,7 @@ parent_call (void *routine, struct FileOpContext *ctx, int argc, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int i;
|
||||
ssize_t ret;
|
||||
|
||||
va_start (ap, argc);
|
||||
parent_call_header (routine, argc, Return_Integer, ctx);
|
||||
@ -443,13 +462,13 @@ parent_call (void *routine, struct FileOpContext *ctx, int argc, ...)
|
||||
|
||||
len = va_arg (ap, int);
|
||||
value = va_arg (ap, void *);
|
||||
write (parent_fd, &len, sizeof (int));
|
||||
write (parent_fd, value, len);
|
||||
ret = write (parent_fd, &len, sizeof (int));
|
||||
ret = write (parent_fd, value, len);
|
||||
}
|
||||
|
||||
read (from_parent_fd, &i, sizeof (int));
|
||||
ret = read (from_parent_fd, &i, sizeof (int));
|
||||
if (ctx)
|
||||
read (from_parent_fd, ctx, sizeof (FileOpContext));
|
||||
ret = read (from_parent_fd, ctx, sizeof (FileOpContext));
|
||||
|
||||
return i;
|
||||
}
|
||||
@ -469,14 +488,20 @@ parent_call_string (void *routine, int argc, ...)
|
||||
|
||||
len = va_arg (ap, int);
|
||||
value = va_arg (ap, void *);
|
||||
write (parent_fd, &len, sizeof (int));
|
||||
write (parent_fd, value, len);
|
||||
if ((write (parent_fd, &len, sizeof (int)) != sizeof (int)) ||
|
||||
(write (parent_fd, value, len) != len))
|
||||
return NULL;
|
||||
}
|
||||
read (from_parent_fd, &i, sizeof (int));
|
||||
if (read (from_parent_fd, &i, sizeof (int)) != sizeof (int))
|
||||
return NULL;
|
||||
if (!i)
|
||||
return NULL;
|
||||
str = g_malloc (i + 1);
|
||||
read (from_parent_fd, str, i);
|
||||
if (read (from_parent_fd, str, i) != i)
|
||||
{
|
||||
g_free(str);
|
||||
return NULL;
|
||||
}
|
||||
str [i] = 0;
|
||||
return str;
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ show_console_contents_linux (int starty, unsigned char begin_line,
|
||||
unsigned char message = 0;
|
||||
unsigned short bytes = 0;
|
||||
int i;
|
||||
ssize_t ret;
|
||||
|
||||
/* Is tty console? */
|
||||
if (!console_flag)
|
||||
@ -73,28 +74,28 @@ show_console_contents_linux (int starty, unsigned char begin_line,
|
||||
|
||||
/* Send command to the console handler */
|
||||
message = CONSOLE_CONTENTS;
|
||||
write (pipefd1[1], &message, 1);
|
||||
ret = write (pipefd1[1], &message, 1);
|
||||
/* Check for outdated cons.saver */
|
||||
read (pipefd2[0], &message, 1);
|
||||
ret = read (pipefd2[0], &message, 1);
|
||||
if (message != CONSOLE_CONTENTS)
|
||||
return;
|
||||
|
||||
/* Send the range of lines that we want */
|
||||
write (pipefd1[1], &begin_line, 1);
|
||||
write (pipefd1[1], &end_line, 1);
|
||||
ret = write (pipefd1[1], &begin_line, 1);
|
||||
ret = write (pipefd1[1], &end_line, 1);
|
||||
/* Read the corresponding number of bytes */
|
||||
read (pipefd2[0], &bytes, 2);
|
||||
ret = read (pipefd2[0], &bytes, 2);
|
||||
|
||||
/* Read the bytes and output them */
|
||||
for (i = 0; i < bytes; i++) {
|
||||
if ((i % COLS) == 0)
|
||||
tty_gotoyx (starty + (i / COLS), 0);
|
||||
read (pipefd2[0], &message, 1);
|
||||
ret = read (pipefd2[0], &message, 1);
|
||||
tty_print_char (message);
|
||||
}
|
||||
|
||||
/* Read the value of the console_flag */
|
||||
read (pipefd2[0], &message, 1);
|
||||
ret = read (pipefd2[0], &message, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -107,58 +108,67 @@ handle_console_linux (unsigned char action)
|
||||
switch (action) {
|
||||
case CONSOLE_INIT:
|
||||
/* Close old pipe ends in case it is the 2nd time we run cons.saver */
|
||||
close (pipefd1[1]);
|
||||
close (pipefd2[0]);
|
||||
status = close (pipefd1[1]);
|
||||
status = close (pipefd2[0]);
|
||||
/* Create two pipes for communication */
|
||||
pipe (pipefd1);
|
||||
pipe (pipefd2);
|
||||
if (!((pipe (pipefd1) == 0) && ((pipe (pipefd2)) == 0)))
|
||||
{
|
||||
console_flag = 0;
|
||||
break;
|
||||
}
|
||||
/* Get the console saver running */
|
||||
cons_saver_pid = fork ();
|
||||
if (cons_saver_pid < 0) {
|
||||
/* Cannot fork */
|
||||
/* Delete pipes */
|
||||
close (pipefd1[1]);
|
||||
close (pipefd1[0]);
|
||||
close (pipefd2[1]);
|
||||
close (pipefd2[0]);
|
||||
status = close (pipefd1[1]);
|
||||
status = close (pipefd1[0]);
|
||||
status = close (pipefd2[1]);
|
||||
status = close (pipefd2[0]);
|
||||
console_flag = 0;
|
||||
} else if (cons_saver_pid > 0) {
|
||||
/* Parent */
|
||||
/* Close the extra pipe ends */
|
||||
close (pipefd1[0]);
|
||||
close (pipefd2[1]);
|
||||
status = close (pipefd1[0]);
|
||||
status = close (pipefd2[1]);
|
||||
/* Was the child successful? */
|
||||
read (pipefd2[0], &console_flag, 1);
|
||||
status = read (pipefd2[0], &console_flag, 1);
|
||||
if (!console_flag) {
|
||||
close (pipefd1[1]);
|
||||
close (pipefd2[0]);
|
||||
waitpid (cons_saver_pid, &status, 0);
|
||||
pid_t ret;
|
||||
status = close (pipefd1[1]);
|
||||
status = close (pipefd2[0]);
|
||||
ret = waitpid (cons_saver_pid, &status, 0);
|
||||
}
|
||||
} else {
|
||||
/* Child */
|
||||
/* Close the extra pipe ends */
|
||||
close (pipefd1[1]);
|
||||
close (pipefd2[0]);
|
||||
status = close (pipefd1[1]);
|
||||
status = close (pipefd2[0]);
|
||||
tty_name = ttyname (0);
|
||||
/* Bind the pipe 0 to the standard input */
|
||||
close (0);
|
||||
dup (pipefd1[0]);
|
||||
close (pipefd1[0]);
|
||||
do {
|
||||
if ( dup2 (pipefd1[0], 0) == -1)
|
||||
break;
|
||||
status = close (pipefd1[0]);
|
||||
/* Bind the pipe 1 to the standard output */
|
||||
close (1);
|
||||
dup (pipefd2[1]);
|
||||
close (pipefd2[1]);
|
||||
if ( dup2 (pipefd2[1], 1) == -1)
|
||||
break;
|
||||
|
||||
status = close (pipefd2[1]);
|
||||
/* Bind standard error to /dev/null */
|
||||
close (2);
|
||||
open ("/dev/null", O_WRONLY);
|
||||
status = open ("/dev/null", O_WRONLY);
|
||||
if ( dup2(status, 2) == -1)
|
||||
break;
|
||||
status = close (status);
|
||||
if (tty_name) {
|
||||
/* Exec the console save/restore handler */
|
||||
mc_conssaver = concat_dir_and_file (SAVERDIR, "cons.saver");
|
||||
execl (mc_conssaver, "cons.saver", tty_name, (char *) NULL);
|
||||
}
|
||||
/* Console is not a tty or execl() failed */
|
||||
} while (0);
|
||||
console_flag = 0;
|
||||
write (1, &console_flag, 1);
|
||||
status = write (1, &console_flag, 1);
|
||||
_exit (3);
|
||||
} /* if (cons_saver_pid ...) */
|
||||
break;
|
||||
@ -176,16 +186,17 @@ handle_console_linux (unsigned char action)
|
||||
return;
|
||||
}
|
||||
/* Send command to the console handler */
|
||||
write (pipefd1[1], &action, 1);
|
||||
status = write (pipefd1[1], &action, 1);
|
||||
if (action != CONSOLE_DONE) {
|
||||
/* Wait the console handler to do its job */
|
||||
read (pipefd2[0], &console_flag, 1);
|
||||
status = read (pipefd2[0], &console_flag, 1);
|
||||
}
|
||||
if (action == CONSOLE_DONE || !console_flag) {
|
||||
/* We are done -> Let's clean up */
|
||||
pid_t ret;
|
||||
close (pipefd1[1]);
|
||||
close (pipefd2[0]);
|
||||
waitpid (cons_saver_pid, &status, 0);
|
||||
ret = waitpid (cons_saver_pid, &status, 0);
|
||||
console_flag = 0;
|
||||
}
|
||||
break;
|
||||
|
13
src/file.c
13
src/file.c
@ -2003,6 +2003,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||
char *temp = NULL;
|
||||
char *save_cwd = NULL, *save_dest = NULL;
|
||||
struct stat src_stat;
|
||||
gboolean ret_val = TRUE;
|
||||
int i;
|
||||
FileProgressStatus value;
|
||||
FileOpContext *ctx;
|
||||
@ -2197,8 +2198,12 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||
/* We now have ETA in all cases */
|
||||
|
||||
/* One file: FIXME mc_chdir will take user out of any vfs */
|
||||
if (operation != OP_COPY && get_current_type () == view_tree)
|
||||
mc_chdir (PATH_SEP_STR);
|
||||
if ((operation != OP_COPY) && (get_current_type () == view_tree) &&
|
||||
(mc_chdir (PATH_SEP_STR) < 0))
|
||||
{
|
||||
ret_val = FALSE;
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
/* The source and src_stat variables have been initialized before */
|
||||
#ifdef WITH_FULL_PATHS
|
||||
@ -2417,7 +2422,9 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||
#endif /* WITH_BACKGROUND */
|
||||
|
||||
file_op_context_destroy (ctx);
|
||||
return TRUE;
|
||||
file_op_total_context_destroy (tctx);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
11
src/find.c
11
src/find.c
@ -137,11 +137,14 @@ typedef struct dir_stack {
|
||||
static dir_stack *dir_stack_base = 0;
|
||||
#endif /* GLIB_CHECK_VERSION */
|
||||
|
||||
static struct {
|
||||
/* *INDENT-OFF* */
|
||||
static struct
|
||||
{
|
||||
const char *text;
|
||||
int len; /* length including space and brackets */
|
||||
int x;
|
||||
} fbuts [] = {
|
||||
} fbuts[] =
|
||||
{
|
||||
{N_("&Suspend"), 11, 29},
|
||||
{N_("Con&tinue"), 12, 29},
|
||||
{N_("&Chdir"), 11, 3},
|
||||
@ -151,6 +154,7 @@ static struct {
|
||||
{N_("&View - F3"), 13, 20},
|
||||
{N_("&Edit - F4"), 13, 38}
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* find file options */
|
||||
typedef struct
|
||||
@ -1304,8 +1308,9 @@ find_file (const char *start_dir, const char *pattern, const char *content,
|
||||
current_panel->is_panelized = 1;
|
||||
|
||||
if (start_dir[0] == PATH_SEP) {
|
||||
int ret;
|
||||
strcpy (current_panel->cwd, PATH_SEP_STR);
|
||||
chdir (PATH_SEP_STR);
|
||||
ret = chdir (PATH_SEP_STR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
src/main.c
12
src/main.c
@ -921,9 +921,10 @@ static void
|
||||
translated_mc_chdir (char *dir)
|
||||
{
|
||||
char *newdir;
|
||||
int ret;
|
||||
|
||||
newdir = vfs_translate_url (dir);
|
||||
mc_chdir (newdir);
|
||||
ret = mc_chdir (newdir);
|
||||
g_free (newdir);
|
||||
}
|
||||
|
||||
@ -1459,10 +1460,11 @@ static void
|
||||
setup_dummy_mc (void)
|
||||
{
|
||||
char d[MC_MAXPATHLEN];
|
||||
int ret;
|
||||
|
||||
mc_get_current_wd (d, MC_MAXPATHLEN);
|
||||
setup_mc ();
|
||||
mc_chdir (d);
|
||||
ret = mc_chdir (d);
|
||||
}
|
||||
|
||||
static void check_codeset()
|
||||
@ -2284,8 +2286,10 @@ main (int argc, char *argv[])
|
||||
S_IRUSR | S_IWUSR);
|
||||
|
||||
if (last_wd_fd != -1) {
|
||||
write (last_wd_fd, last_wd_string, strlen (last_wd_string));
|
||||
close (last_wd_fd);
|
||||
ssize_t ret1;
|
||||
int ret2;
|
||||
ret1 = write (last_wd_fd, last_wd_string, strlen (last_wd_string));
|
||||
ret2 = close (last_wd_fd);
|
||||
}
|
||||
}
|
||||
g_free (last_wd_string);
|
||||
|
@ -480,8 +480,9 @@ do_external_panelize (char *command)
|
||||
current_panel->count = next_free;
|
||||
if (list->list[0].fname[0] == PATH_SEP)
|
||||
{
|
||||
int ret;
|
||||
strcpy (current_panel->cwd, PATH_SEP_STR);
|
||||
chdir (PATH_SEP_STR);
|
||||
ret = chdir (PATH_SEP_STR);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
23
src/screen.c
23
src/screen.c
@ -1404,7 +1404,10 @@ panel_new_with_dir (const char *panel_name, const char *wpath)
|
||||
|
||||
/* Because do_load_dir lists files in current directory */
|
||||
if (wpath)
|
||||
mc_chdir (wpath);
|
||||
{
|
||||
int ret;
|
||||
ret = mc_chdir (wpath);
|
||||
}
|
||||
|
||||
/* Load the default format */
|
||||
panel->count =
|
||||
@ -1413,7 +1416,10 @@ panel_new_with_dir (const char *panel_name, const char *wpath)
|
||||
|
||||
/* Restore old right path */
|
||||
if (wpath)
|
||||
mc_chdir (curdir);
|
||||
{
|
||||
int ret;
|
||||
ret = mc_chdir (curdir);
|
||||
}
|
||||
|
||||
return panel;
|
||||
}
|
||||
@ -3467,7 +3473,10 @@ reload_panelized (WPanel * panel)
|
||||
dir_list *list = &panel->dir;
|
||||
|
||||
if (panel != current_panel)
|
||||
mc_chdir (panel->cwd);
|
||||
{
|
||||
int ret;
|
||||
ret = mc_chdir (panel->cwd);
|
||||
}
|
||||
|
||||
for (i = 0, j = 0; i < panel->count; i++)
|
||||
{
|
||||
@ -3498,7 +3507,10 @@ reload_panelized (WPanel * panel)
|
||||
panel->count = j;
|
||||
|
||||
if (panel != current_panel)
|
||||
mc_chdir (current_panel->cwd);
|
||||
{
|
||||
int ret;
|
||||
ret = mc_chdir (current_panel->cwd);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3560,6 +3572,7 @@ update_panels (int force_update, const char *current_file)
|
||||
{
|
||||
int reload_other = !(force_update & UP_ONLY_CURRENT);
|
||||
WPanel *panel;
|
||||
int ret;
|
||||
|
||||
update_one_panel (get_current_index (), force_update, current_file);
|
||||
if (reload_other)
|
||||
@ -3570,7 +3583,7 @@ update_panels (int force_update, const char *current_file)
|
||||
else
|
||||
panel = (WPanel *) get_panel_widget (get_other_index ());
|
||||
|
||||
mc_chdir (panel->cwd);
|
||||
ret = mc_chdir (panel->cwd);
|
||||
}
|
||||
|
||||
gsize
|
||||
|
@ -227,7 +227,10 @@ init_subshell_child (const char *pty_name)
|
||||
|
||||
/* It simplifies things to change to our home directory here, */
|
||||
/* and the user's startup file may do a `cd' command anyway */
|
||||
chdir (home_dir); /* FIXME? What about when we re-run the subshell? */
|
||||
{
|
||||
int ret;
|
||||
ret = chdir (home_dir); /* FIXME? What about when we re-run the subshell? */
|
||||
}
|
||||
|
||||
/* Set MC_SID to prevent running one mc from another */
|
||||
mc_sid = getsid (0);
|
||||
|
@ -663,13 +663,14 @@ tree_rescan (void *data)
|
||||
{
|
||||
char old_dir[MC_MAXPATHLEN];
|
||||
WTree *tree = data;
|
||||
int ret;
|
||||
|
||||
if (!tree->selected_ptr || !mc_get_current_wd (old_dir, MC_MAXPATHLEN) ||
|
||||
mc_chdir (tree->selected_ptr->name))
|
||||
return;
|
||||
|
||||
tree_store_rescan (tree->selected_ptr->name);
|
||||
mc_chdir (old_dir);
|
||||
ret = mc_chdir (old_dir);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -190,13 +190,16 @@ tree_store_load_from(char *name)
|
||||
file = fopen(name, "r");
|
||||
|
||||
if (file) {
|
||||
fgets(buffer, sizeof(buffer), file);
|
||||
|
||||
if ( fgets(buffer, sizeof(buffer), file) != NULL )
|
||||
{
|
||||
if (strncmp(buffer, TREE_SIGNATURE, strlen(TREE_SIGNATURE)) != 0) {
|
||||
fclose(file);
|
||||
do_load = FALSE;
|
||||
} else
|
||||
do_load = TRUE;
|
||||
}
|
||||
else
|
||||
do_load = FALSE;
|
||||
} else
|
||||
do_load = FALSE;
|
||||
|
||||
|
@ -615,6 +615,8 @@ save_text_to_clip_file (const char *text)
|
||||
{
|
||||
int file;
|
||||
char *fname = NULL;
|
||||
ssize_t ret;
|
||||
size_t str_len;
|
||||
|
||||
fname = g_build_filename (home_dir, EDIT_CLIP_FILE, NULL);
|
||||
file = mc_open (fname, O_CREAT | O_WRONLY | O_TRUNC,
|
||||
@ -624,9 +626,10 @@ save_text_to_clip_file (const char *text)
|
||||
if (file == -1)
|
||||
return FALSE;
|
||||
|
||||
mc_write (file, (char *) text, strlen (text));
|
||||
str_len = strlen (text);
|
||||
ret = mc_write (file, (char *) text, str_len);
|
||||
mc_close (file);
|
||||
return TRUE;
|
||||
return ret == (ssize_t) str_len;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user