Move public modules before function definitions
@@ -20,21 +20,6 @@ use std::path::Path;
use super::error::CliError;
-fn chown(path: &Path, uid: u32, gid: u32) -> Result<(), CliError> {
- let pathstr = path
- .to_str()
- .ok_or_else(|| CliError::UserError(format!("Invalid path: {:?}", path)))?;
- let cpath = CString::new(pathstr).map_err(|err| CliError::UserError(format!("{}", err)))?;
- let result = unsafe { libc::chown(cpath.as_ptr(), uid, gid) };
- match result {
- 0 => Ok(()),
- code => Err(CliError::UserError(format!(
- "Error chowning file {}: {}",
- pathstr, code
- ))),
- }
-}
-
#[cfg(feature = "pike")]
pub mod agent;
#[cfg(feature = "database")]
@@ -55,3 +40,18 @@ pub mod schema;
#[cfg(any(feature = "purchase-order", feature = "product"))]
pub const DEFAULT_SCHEMA_DIR: &str = "/etc/grid/schemas";
+
+fn chown(path: &Path, uid: u32, gid: u32) -> Result<(), CliError> {
+ let pathstr = path
+ .to_str()
+ .ok_or_else(|| CliError::UserError(format!("Invalid path: {:?}", path)))?;
+ let cpath = CString::new(pathstr).map_err(|err| CliError::UserError(format!("{}", err)))?;
+ let result = unsafe { libc::chown(cpath.as_ptr(), uid, gid) };
+ match result {
+ 0 => Ok(()),
+ code => Err(CliError::UserError(format!(
+ "Error chowning file {}: {}",
+ pathstr, code
+ ))),
+ }
+}
