mirror of
https://github.com/davatorium/rofi.git
synced 2025-02-10 15:44:41 -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.
|
// Rewind.
|
||||||
fseek(fd, 0L, SEEK_SET);
|
fseek(fd, 0L, SEEK_SET);
|
||||||
// Clear file.
|
// Clear file.
|
||||||
ftruncate(fileno(fd), 0);
|
if ( ftruncate(fileno(fd), 0) == 0)
|
||||||
|
{
|
||||||
// Write list.
|
// Write list.
|
||||||
__history_write_element_list(fd, list, length);
|
__history_write_element_list(fd, list, length);
|
||||||
|
}else {
|
||||||
|
fprintf(stderr, "Failed to truncate file: %s\n", strerror(errno));
|
||||||
|
}
|
||||||
// Free the list.
|
// Free the list.
|
||||||
for(unsigned int iter = 0; iter < length; iter++)
|
for(unsigned int iter = 0; iter < length; iter++)
|
||||||
{
|
{
|
||||||
|
@ -207,10 +208,12 @@ void history_remove ( const char *filename, const char *entry )
|
||||||
// Rewind.
|
// Rewind.
|
||||||
fseek(fd, 0L, SEEK_SET);
|
fseek(fd, 0L, SEEK_SET);
|
||||||
// Clear list.
|
// Clear list.
|
||||||
ftruncate(fileno(fd), 0);
|
if(ftruncate(fileno(fd), 0) == 0) {
|
||||||
|
|
||||||
// Write list.
|
// Write list.
|
||||||
__history_write_element_list(fd, list, length);
|
__history_write_element_list(fd, list, length);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Failed to open file: %s\n", strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free the list.
|
// Free the list.
|
||||||
|
|
|
@ -151,9 +151,12 @@ static char ** get_ssh ( )
|
||||||
num_favorites = index;
|
num_favorites = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FILE *fd = NULL;
|
||||||
const char *hd = getenv ( "HOME" );
|
const char *hd = getenv ( "HOME" );
|
||||||
asprintf ( &path, "%s/%s", hd, ".ssh/config" );
|
if(asprintf ( &path, "%s/%s", hd, ".ssh/config" )>= 0){
|
||||||
FILE *fd = fopen ( path, "r" );
|
fd = fopen ( path, "r" );
|
||||||
|
}
|
||||||
|
|
||||||
if ( fd != NULL )
|
if ( fd != NULL )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue