diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2012-04-16 15:36:13 +0200 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2012-04-16 15:36:13 +0200 |
commit | 08c7ddd0e71a6ee4b448cfa9e5df6dbbae8898a5 (patch) | |
tree | 992592cd5a547189a10883b56835bcadfa945066 /pgsql.c | |
parent | a43dcf069684dbdc9897e1364e1ef4165edc3cc9 (diff) | |
download | pgfuse-08c7ddd0e71a6ee4b448cfa9e5df6dbbae8898a5.tar.gz pgfuse-08c7ddd0e71a6ee4b448cfa9e5df6dbbae8898a5.tar.bz2 |
added local symlinks, stil a cross directory problem
Diffstat (limited to 'pgsql.c')
-rw-r--r-- | pgsql.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -109,16 +109,17 @@ int psql_write_meta( PGconn *conn, const int id, const char *path, PgMeta meta ) int psql_create_file( PGconn *conn, const int parent_id, const char *path, const char *new_file, PgMeta meta ) { int param1 = htonl( parent_id ); - int param2 = htonl( meta.mode ); - int param3 = htonl( meta.uid ); - int param4 = htonl( meta.gid ); - const char *values[6] = { (const char *)¶m1, new_file, path, (const char *)¶m2, (const char *)¶m3, (const char *)¶m4 }; - int lengths[6] = { sizeof( param1 ), strlen( new_file ), strlen( path ), sizeof( param2 ), sizeof( param3 ), sizeof( param4 ) }; - int binary[6] = { 1, 0, 0, 1, 1, 1 }; + int param2 = htonl( meta.size ); + int param3 = htonl( meta.mode ); + int param4 = htonl( meta.uid ); + int param5 = htonl( meta.gid ); + const char *values[7] = { (const char *)¶m1, new_file, path, (const char *)¶m2, (const char *)¶m3, (const char *)¶m4, (const char *)¶m5 }; + int lengths[7] = { sizeof( param1 ), strlen( new_file ), strlen( path ), sizeof( param2 ), sizeof( param3 ), sizeof( param4 ), sizeof( param5 ) }; + int binary[7] = { 1, 0, 0, 1, 1, 1, 1 }; PGresult *res; - res = PQexecParams( conn, "INSERT INTO dir( parent_id, name, path, mode, uid, gid ) VALUES ($1::int4, $2::varchar, $3::varchar, $4::int4, $5::int4, $6::int4 )", - 6, NULL, values, lengths, binary, 1 ); + res = PQexecParams( conn, "INSERT INTO dir( parent_id, name, path, size, mode, uid, gid ) VALUES ($1::int4, $2::varchar, $3::varchar, $4::int4, $5::int4, $6::int4, $7::int4 )", + 7, NULL, values, lengths, binary, 1 ); if( PQresultStatus( res ) != PGRES_COMMAND_OK ) { syslog( LOG_ERR, "Error in psql_create_file for path '%s': %s", @@ -128,7 +129,7 @@ int psql_create_file( PGconn *conn, const int parent_id, const char *path, const } PQclear( res ); - + return 0; } |