]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Properly format Content-Length: header on 32-bit systems. 92/head
authorJan Harkes <jaharkes@cs.cmu.edu>
Thu, 7 Mar 2013 21:07:26 +0000 (16:07 -0500)
committerJan Harkes <jaharkes@cs.cmu.edu>
Fri, 8 Mar 2013 17:28:54 +0000 (12:28 -0500)
- Promote len argument in dump_content_length to uint64_t.
- Make sure there is sufficient scratch space to format string.
- Use PRIu64 macro for formatting.

Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h

index 363feac56c1f47fd941b4112297c69a8772a3a54..8b1c2c5e32572e0a016a3ff81b8b868ce283eaa6 100644 (file)
@@ -227,10 +227,10 @@ void dump_errno(struct req_state *s, int err)
   dump_status(s, buf);
 }
 
-void dump_content_length(struct req_state *s, size_t len)
+void dump_content_length(struct req_state *s, uint64_t len)
 {
-  char buf[16];
-  snprintf(buf, sizeof(buf), "%lu", (long unsigned int)len);
+  char buf[21];
+  snprintf(buf, sizeof(buf), "%"PRIu64, len);
   int r = s->cio->print("Content-Length: %s\n", buf);
   if (r < 0) {
     ldout(s->cct, 0) << "ERROR: s->cio->print() returned err=" << r << dendl;
index 00ad584575eb170901664266cc09a8fc9b910e2e..7dd61bdb1e5d13a49bdcae315e7395fe63a2d2f5 100644 (file)
@@ -281,7 +281,7 @@ extern void end_header(struct req_state *s, const char *content_type = NULL);
 extern void dump_start(struct req_state *s);
 extern void list_all_buckets_start(struct req_state *s);
 extern void dump_owner(struct req_state *s, string& id, string& name, const char *section = NULL);
-extern void dump_content_length(struct req_state *s, size_t len);
+extern void dump_content_length(struct req_state *s, uint64_t len);
 extern void dump_etag(struct req_state *s, const char *etag);
 extern void dump_last_modified(struct req_state *s, time_t t);
 extern void abort_early(struct req_state *s, int err);