diff --git a/obexd/src/ftp.c b/obexd/src/ftp.c
index 25aae3f..b4dc425 100644
--- a/obexd/src/ftp.c
+++ b/obexd/src/ftp.c
"modified=\"%s\" created=\"%s\"/>" EOL_CHARS
-static gchar *file_stat_line(gchar *filename, struct stat fstat,
- struct stat dstat)
+static gchar *file_stat_line(gchar *filename, struct stat fstat, struct stat dstat)
{
- gchar *perm, atime[17], ctime[17], mtime[17], *result;
+ gchar perm[50], atime[17], ctime[17], mtime[17];
- perm = g_strdup_printf("user-perm=\"%s%s%s\" group-perm=\"%s%s%s\" "
+ snprintf(perm, 49, "user-perm=\"%s%s%s\" group-perm=\"%s%s%s\" "
"other-perm=\"%s%s%s\"",
(fstat.st_mode & S_IRUSR ? "R" : ""),
(fstat.st_mode & S_IWUSR ? "W" : ""),
strftime(mtime, 16, "%Y%m%dT%H%M%S", gmtime(&fstat.st_mtime));
if (S_ISDIR(fstat.st_mode))
- result = g_strdup_printf(FL_FOLDER_ELEMENT, filename,
- perm, atime, mtime, ctime);
- else
- result = g_strdup_printf(FL_FILE_ELEMENT, filename, fstat.st_size,
- perm, atime, mtime, ctime);
+ return g_strdup_printf(FL_FOLDER_ELEMENT, filename,
+ perm, atime, mtime, ctime);
- g_free(perm);
-
- return result;
+ return g_strdup_printf(FL_FILE_ELEMENT, filename, fstat.st_size,
+ perm, atime, mtime, ctime);
}
static gboolean folder_listing(struct obex_session *os, guint32 *size)
if (strcmp(os->current_folder,os->server->folder))
listing = g_string_append(listing, FL_PARENT_FOLDER_ELEMENT);
- if (stat(os->current_folder, &dstat) < 0) {
- error("get_folder_listing: %s(%d)", strerror(errno), errno);
+ if (lstat(os->current_folder, &dstat) < 0) {
+ error("lstat: %s(%d)", strerror(errno), errno);
return FALSE;
}
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index f831337..f9d2784 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
}
}
- if (!os->name) {
- OBEX_ObjectSetRsp(obj, OBEX_RSP_BAD_REQUEST,
- OBEX_RSP_BAD_REQUEST);
- return;
- }
-
os->cmds->setpath(obex, obj);
}
emit_transfer_progress(os->cid, os->size, os->offset);
break;
case OBEX_EV_ABORT:
+ os_reset_session(os);
OBEX_ObjectSetRsp(obj, OBEX_RSP_SUCCESS, OBEX_RSP_SUCCESS);
break;
case OBEX_EV_REQDONE: