Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/majn/tgl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkenorb <kenorb@users.noreply.github.com>2019-02-03 01:55:33 +0300
committerkenorb <kenorb@users.noreply.github.com>2019-02-03 01:55:33 +0300
commita02aa374aac631ee37886af8da0a7e381a8bf205 (patch)
tree4d4d6acd88f78262a4ab73117860e4f7c7fcd926
parent86155ef7cfbb7e1b473dc51628e36df6c49443df (diff)
parent6b8da837e4ee6d2f402bc47efe9d2c0f5015b858 (diff)
Merge branch 'expand_tilde' of https://github.com/C-Elegans/tgl
-rw-r--r--queries.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/queries.c b/queries.c
index 467e84c..58f285b 100644
--- a/queries.c
+++ b/queries.c
@@ -31,6 +31,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <wordexp.h>
#ifndef WIN32
#include <sys/utsname.h>
#endif
@@ -2120,7 +2121,12 @@ static void send_file_thumb (struct tgl_state *TLS, struct send_file *f, const v
static void _tgl_do_send_photo (struct tgl_state *TLS, tgl_peer_id_t to_id, const char *file_name, tgl_peer_id_t avatar, int w, int h, int duration, const void *thumb_data, int thumb_len, const char *caption, int caption_len, unsigned long long flags, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success, struct tgl_message *M), void *callback_extra) {
- int fd = open (file_name, O_RDONLY | O_BINARY);
+ wordexp_t wrdexp;
+ int status = wordexp(file_name,&wrdexp,0);
+ int fd=-1;
+ if(status == 0)
+ fd = open (wrdexp.we_wordv[0], O_RDONLY | O_BINARY);
+ wordfree(&wrdexp);
if (fd < 0) {
tgl_set_query_error (TLS, EBADF, "Can not open file: %s", strerror(errno));
if (!avatar.peer_id) {