mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Small fixes
This commit is contained in:
parent
87b51f5430
commit
a925e59653
2 changed files with 18 additions and 12 deletions
|
@ -153,12 +153,13 @@ void history_set ( const char *filename, const char *entry )
|
|||
// Rewind.
|
||||
fseek(fd, 0L, SEEK_SET);
|
||||
// Clear file.
|
||||
ftruncate(fileno(fd), 0);
|
||||
|
||||
// Write list.
|
||||
__history_write_element_list(fd, list, length);
|
||||
|
||||
|
||||
if ( ftruncate(fileno(fd), 0) == 0)
|
||||
{
|
||||
// Write list.
|
||||
__history_write_element_list(fd, list, length);
|
||||
}else {
|
||||
fprintf(stderr, "Failed to truncate file: %s\n", strerror(errno));
|
||||
}
|
||||
// Free the list.
|
||||
for(unsigned int iter = 0; iter < length; iter++)
|
||||
{
|
||||
|
@ -207,10 +208,12 @@ void history_remove ( const char *filename, const char *entry )
|
|||
// Rewind.
|
||||
fseek(fd, 0L, SEEK_SET);
|
||||
// Clear list.
|
||||
ftruncate(fileno(fd), 0);
|
||||
|
||||
// Write list.
|
||||
__history_write_element_list(fd, list, length);
|
||||
if(ftruncate(fileno(fd), 0) == 0) {
|
||||
// Write list.
|
||||
__history_write_element_list(fd, list, length);
|
||||
} else {
|
||||
fprintf(stderr, "Failed to open file: %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
// Free the list.
|
||||
|
|
|
@ -151,9 +151,12 @@ static char ** get_ssh ( )
|
|||
num_favorites = index;
|
||||
}
|
||||
|
||||
|
||||
FILE *fd = NULL;
|
||||
const char *hd = getenv ( "HOME" );
|
||||
asprintf ( &path, "%s/%s", hd, ".ssh/config" );
|
||||
FILE *fd = fopen ( path, "r" );
|
||||
if(asprintf ( &path, "%s/%s", hd, ".ssh/config" )>= 0){
|
||||
fd = fopen ( path, "r" );
|
||||
}
|
||||
|
||||
if ( fd != NULL )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue