Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cloudfiles symlink()

  • Loading branch information...
commit 5495028500c686da61665cbbf4a60f44a64a16f6 1 parent ee78bfe
@benlemasurier authored
Showing with 24 additions and 1 deletion.
  1. +21 −1 src/cloudfiles.c
  2. +3 −0  src/proxy.c
View
22 src/cloudfiles.c
@@ -309,7 +309,27 @@ cloudfiles_rmdir(const char *path)
int
cloudfiles_symlink(const char *from, const char *to, struct stat *st)
{
- return -ENOTSUP;
+ int result, fd;
+ GList *headers = NULL;
+
+ if((fd = fileno(tmpfile())) == -1)
+ return -errno;
+
+ if(pwrite(fd, from, strlen(from), 0) == -1) {
+ close(fd);
+ return -errno;
+ }
+
+ headers = add_header(headers, cf_mode_header(st->st_mode));
+ headers = add_header(headers, cf_mtime_header(st->st_mtime));
+
+ result = cloudfiles_curl_upload(to, headers, fd);
+
+ free_headers(headers);
+ if(close(fd) != 0)
+ return -errno;
+
+ return result;
}
int
View
3  src/proxy.c
@@ -282,6 +282,9 @@ proxy_symlink(const char *from, const char *to, struct stat *st)
case S3:
result = s3_symlink(from, to, st);
break;
+ case CLOUDFILES:
+ result = cloudfiles_symlink(from, to, st);
+ break;
default:
result = -ENOTSUP;
}
Please sign in to comment.
Something went wrong with that request. Please try again.